标签打印
parent
197dcabf68
commit
17a45bff59
@ -1,13 +0,0 @@
|
||||
package com.foreverwin.mesnac.common.service;
|
||||
|
||||
|
||||
import com.foreverwin.mesnac.common.model.PrintRequest;
|
||||
|
||||
/**
|
||||
* @author Ervin Chen
|
||||
* @date 2020/3/6 13:37
|
||||
*/
|
||||
public interface PrintService {
|
||||
|
||||
void print(PrintRequest printRequest);
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package com.foreverwin.mesnac.common.service.impl;
|
||||
|
||||
|
||||
import com.foreverwin.mesnac.common.model.PrintRequest;
|
||||
import com.foreverwin.mesnac.common.service.PrintService;
|
||||
import com.foreverwin.mesnac.common.util.HttpUtils;
|
||||
import com.foreverwin.mesnac.meapi.util.StringUtils;
|
||||
import com.foreverwin.modular.core.exception.BusinessException;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* @author Ervin Chen
|
||||
* @date 2020/3/6 13:38
|
||||
*/
|
||||
@Service
|
||||
public class PrintServiceImpl implements PrintService {
|
||||
|
||||
@Value("${print.server}")
|
||||
private String printServer;
|
||||
|
||||
@Override
|
||||
public void print(PrintRequest printRequest) {
|
||||
String printer = printRequest.getPrinter();
|
||||
String printTemplate = printRequest.getTemplate();
|
||||
|
||||
if (StringUtils.isBlank(printer)) {
|
||||
throw BusinessException.build("打印机未维护");
|
||||
}
|
||||
if (StringUtils.isBlank(printTemplate)) {
|
||||
throw BusinessException.build("打印模板未维护");
|
||||
}
|
||||
|
||||
//发送打印请求
|
||||
ResponseEntity responseEntity = HttpUtils.callPost(printServer, "REQUEST_DATA=" + printRequest.toString());
|
||||
}
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
package com.foreverwin.mesnac.meapi.controller;
|
||||
|
||||
import com.foreverwin.modular.core.util.R;
|
||||
import com.foreverwin.modular.core.util.FrontPage;
|
||||
import com.foreverwin.modular.core.util.CommonMethods;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.foreverwin.mesnac.meapi.service.PrinterService;
|
||||
import com.foreverwin.mesnac.meapi.model.Printer;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Leon.L
|
||||
* @since 2021-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/PRINTER")
|
||||
public class PrinterController {
|
||||
|
||||
@Autowired
|
||||
public PrinterService printerService;
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/{id:.+}")
|
||||
public R getPrinterById(@PathVariable String id) {
|
||||
return R.ok( printerService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("")
|
||||
public R getPrinterList(Printer printer){
|
||||
List<Printer> result;
|
||||
try {
|
||||
String site = CommonMethods.getSite();
|
||||
printer.setSite(site);
|
||||
|
||||
QueryWrapper<Printer> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(printer);
|
||||
result = printerService.list(queryWrapper);
|
||||
} catch (Exception e) {
|
||||
return R.failed(e.getMessage());
|
||||
}
|
||||
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询数据
|
||||
*
|
||||
* @param frontPage 分页信息
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/page")
|
||||
public R page(FrontPage<Printer> frontPage, Printer printer){
|
||||
IPage result;
|
||||
QueryWrapper<Printer> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(printer);
|
||||
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
|
||||
//TODO modify global query
|
||||
queryWrapper.lambda().and(wrapper -> wrapper
|
||||
.like(Printer::getHandle, frontPage.getGlobalQuery())
|
||||
.or().like(Printer::getSite, frontPage.getGlobalQuery())
|
||||
.or().like(Printer::getPrinter, frontPage.getGlobalQuery())
|
||||
.or().like(Printer::getDescription, frontPage.getGlobalQuery())
|
||||
.or().like(Printer::getEnabled, frontPage.getGlobalQuery())
|
||||
);
|
||||
}
|
||||
result = printerService.page(frontPage.getPagePlus(), queryWrapper);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param printer 传递的实体
|
||||
* @return null 失败 实体成功
|
||||
*/
|
||||
@PostMapping
|
||||
public R save(@RequestBody Printer printer) {
|
||||
return R.ok(printerService.save(printer));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param printer 传递的实体
|
||||
* @return null 失败 实体成功
|
||||
*/
|
||||
@PutMapping
|
||||
public R updateById(@RequestBody Printer printer) {
|
||||
return R.ok(printerService.updateById(printer));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id删除对象
|
||||
* @param id 实体ID
|
||||
* @return 0 失败 1 成功
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
|
||||
public R removeById(@PathVariable("id") String id){
|
||||
return R.ok(printerService.removeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除对象
|
||||
* @param ids 实体集合ID
|
||||
* @return 0 失败 1 成功
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/delete-batch")
|
||||
public R removeByIds(List<String> ids){
|
||||
return R.ok(printerService.removeByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.foreverwin.mesnac.meapi.mapper;
|
||||
|
||||
import com.foreverwin.mesnac.meapi.model.Printer;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Leon.L
|
||||
* @since 2021-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface PrinterMapper extends BaseMapper<Printer> {
|
||||
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
package com.foreverwin.mesnac.meapi.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author Leon.L
|
||||
* @since 2021-07-22
|
||||
*/
|
||||
|
||||
@TableName("PRINTER")
|
||||
public class Printer extends Model<Printer> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableField("HANDLE")
|
||||
private String handle;
|
||||
@TableField("SITE")
|
||||
private String site;
|
||||
@TableField("PRINTER")
|
||||
private String printer;
|
||||
@TableField("DESCRIPTION")
|
||||
private String description;
|
||||
@TableField("ENABLED")
|
||||
private String enabled;
|
||||
@TableField("CREATED_DATE_TIME")
|
||||
private LocalDateTime createdDateTime;
|
||||
@TableField("MODIFIED_DATE_TIME")
|
||||
private LocalDateTime modifiedDateTime;
|
||||
|
||||
|
||||
public String getHandle() {
|
||||
return handle;
|
||||
}
|
||||
|
||||
public void setHandle(String handle) {
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
public String getSite() {
|
||||
return site;
|
||||
}
|
||||
|
||||
public void setSite(String site) {
|
||||
this.site = site;
|
||||
}
|
||||
|
||||
public String getPrinter() {
|
||||
return printer;
|
||||
}
|
||||
|
||||
public void setPrinter(String printer) {
|
||||
this.printer = printer;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(String enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedDateTime() {
|
||||
return createdDateTime;
|
||||
}
|
||||
|
||||
public void setCreatedDateTime(LocalDateTime createdDateTime) {
|
||||
this.createdDateTime = createdDateTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getModifiedDateTime() {
|
||||
return modifiedDateTime;
|
||||
}
|
||||
|
||||
public void setModifiedDateTime(LocalDateTime modifiedDateTime) {
|
||||
this.modifiedDateTime = modifiedDateTime;
|
||||
}
|
||||
|
||||
public static final String HANDLE = "HANDLE";
|
||||
|
||||
public static final String SITE = "SITE";
|
||||
|
||||
public static final String PRINTER = "PRINTER";
|
||||
|
||||
public static final String DESCRIPTION = "DESCRIPTION";
|
||||
|
||||
public static final String ENABLED = "ENABLED";
|
||||
|
||||
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
|
||||
|
||||
public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
|
||||
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.handle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Printer{" +
|
||||
"handle = " + handle +
|
||||
", site = " + site +
|
||||
", printer = " + printer +
|
||||
", description = " + description +
|
||||
", enabled = " + enabled +
|
||||
", createdDateTime = " + createdDateTime +
|
||||
", modifiedDateTime = " + modifiedDateTime +
|
||||
"}";
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.foreverwin.mesnac.meapi.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.foreverwin.mesnac.meapi.model.Printer;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.modular.core.util.FrontPage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Leon.L
|
||||
* @since 2021-07-22
|
||||
*/
|
||||
public interface PrinterService extends IService<Printer> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param frontPage
|
||||
* @return
|
||||
*/
|
||||
IPage<Printer> selectPage(FrontPage<Printer> frontPage, Printer printer);
|
||||
|
||||
List<Printer> selectList(Printer printer);
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.foreverwin.mesnac.meapi.service.impl;
|
||||
|
||||
import com.foreverwin.modular.core.util.FrontPage;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.foreverwin.mesnac.meapi.model.Printer;
|
||||
import com.foreverwin.mesnac.meapi.mapper.PrinterMapper;
|
||||
import com.foreverwin.mesnac.meapi.service.PrinterService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Leon.L
|
||||
* @since 2021-07-22
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class PrinterServiceImpl extends ServiceImpl<PrinterMapper, Printer> implements PrinterService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private PrinterMapper printerMapper;
|
||||
|
||||
@Override
|
||||
public IPage<Printer> selectPage(FrontPage<Printer> frontPage, Printer printer) {
|
||||
QueryWrapper<Printer> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(printer);
|
||||
return super.page(frontPage.getPagePlus(), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Printer> selectList(Printer printer) {
|
||||
QueryWrapper<Printer> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(printer);
|
||||
return super.list(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,318 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.foreverwin.mesnac.meapi.mapper.PrinterMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.meapi.model.Printer">
|
||||
<result column="HANDLE" property="handle" />
|
||||
<result column="SITE" property="site" />
|
||||
<result column="PRINTER" property="printer" />
|
||||
<result column="DESCRIPTION" property="description" />
|
||||
<result column="ENABLED" property="enabled" />
|
||||
<result column="CREATED_DATE_TIME" property="createdDateTime" />
|
||||
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
HANDLE, SITE, PRINTER, DESCRIPTION, ENABLED, CREATED_DATE_TIME, MODIFIED_DATE_TIME
|
||||
</sql>
|
||||
|
||||
<!-- BaseMapper标准查询/修改/删除 -->
|
||||
|
||||
<select id="selectByMap" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"></include>
|
||||
FROM PRINTER
|
||||
<if test="cm!=null and !cm.isEmpty">
|
||||
<where>
|
||||
<foreach collection="cm.keys" item="k" separator="AND">
|
||||
<if test="cm[k] != null">
|
||||
${k} = #{cm[${k}]}
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectOne" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"></include> FROM PRINTER
|
||||
<where>
|
||||
<if test="ew.entity.handle!=null">
|
||||
HANDLE=#{ew.handle}
|
||||
</if>
|
||||
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
||||
<if test="ew.entity.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
|
||||
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
|
||||
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
||||
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectCount" resultType="Integer">
|
||||
SELECT COUNT(1) FROM PRINTER
|
||||
<where>
|
||||
<if test="ew!=null">
|
||||
<if test="ew.entity!=null">
|
||||
<if test="ew.entity.handle!=null">
|
||||
HANDLE=#{ew.entity.handle}
|
||||
</if>
|
||||
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
||||
<if test="ew.entity.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
|
||||
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
|
||||
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
||||
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
||||
</if>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectList" resultMap="BaseResultMap">
|
||||
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM PRINTER
|
||||
<where>
|
||||
<if test="ew!=null">
|
||||
<if test="ew.entity!=null">
|
||||
<if test="ew.entity.handle!=null">
|
||||
HANDLE=#{ew.entity.handle}
|
||||
</if>
|
||||
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
||||
<if test="ew.entity.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
|
||||
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
|
||||
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
||||
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
||||
</if>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectMaps" resultType="HashMap">
|
||||
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM PRINTER
|
||||
<where>
|
||||
<if test="ew!=null">
|
||||
<if test="ew.entity!=null">
|
||||
<if test="ew.entity.handle!=null">
|
||||
HANDLE=#{ew.entity.handle}
|
||||
</if>
|
||||
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
||||
<if test="ew.entity.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
|
||||
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
|
||||
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
||||
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
||||
</if>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectObjs" resultType="Object">
|
||||
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM PRINTER
|
||||
<where>
|
||||
<if test="ew!=null">
|
||||
<if test="ew.entity!=null">
|
||||
<if test="ew.entity.handle!=null">
|
||||
HANDLE=#{ew.entity.handle}
|
||||
</if>
|
||||
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
||||
<if test="ew.entity.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
|
||||
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
|
||||
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
||||
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
||||
</if>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectPage" resultMap="BaseResultMap">
|
||||
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM PRINTER
|
||||
<where>
|
||||
<if test="ew!=null">
|
||||
<if test="ew.entity!=null">
|
||||
<if test="ew.entity.handle!=null">
|
||||
HANDLE=#{ew.entity.handle}
|
||||
</if>
|
||||
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
||||
<if test="ew.entity.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
|
||||
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
|
||||
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
||||
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
||||
</if>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectMapsPage" resultType="HashMap">
|
||||
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM PRINTER
|
||||
<where>
|
||||
<if test="ew!=null">
|
||||
<if test="ew.entity!=null">
|
||||
<if test="ew.entity.handle!=null">
|
||||
HANDLE=#{ew.entity.handle}
|
||||
</if>
|
||||
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
||||
<if test="ew.entity.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
|
||||
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
|
||||
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
||||
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
||||
</if>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.foreverwin.mesnac.meapi.model.Printer">
|
||||
INSERT INTO PRINTER
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
HANDLE,
|
||||
<if test="site!=null">SITE,</if>
|
||||
<if test="printer!=null">PRINTER,</if>
|
||||
<if test="description!=null">DESCRIPTION,</if>
|
||||
<if test="enabled!=null">ENABLED,</if>
|
||||
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
|
||||
<if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
|
||||
</trim> VALUES
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
#{handle},
|
||||
<if test="site!=null">#{site},</if>
|
||||
<if test="printer!=null">#{printer},</if>
|
||||
<if test="description!=null">#{description},</if>
|
||||
<if test="enabled!=null">#{enabled},</if>
|
||||
<if test="createdDateTime!=null">#{createdDateTime},</if>
|
||||
<if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.meapi.model.Printer">
|
||||
INSERT INTO PRINTER
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<include refid="Base_Column_List"></include>
|
||||
</trim> VALUES
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
#{handle},
|
||||
#{site},
|
||||
#{printer},
|
||||
#{description},
|
||||
#{enabled},
|
||||
#{createdDateTime},
|
||||
#{modifiedDateTime},
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<update id="update">
|
||||
UPDATE PRINTER <trim prefix="SET" suffixOverrides=",">
|
||||
<if test="et.handle!=null">HANDLE=#{et.handle},</if>
|
||||
<if test="et.site!=null">SITE=#{et.site},</if>
|
||||
<if test="et.printer!=null">PRINTER=#{et.printer},</if>
|
||||
<if test="et.description!=null">DESCRIPTION=#{et.description},</if>
|
||||
<if test="et.enabled!=null">ENABLED=#{et.enabled},</if>
|
||||
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
|
||||
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
|
||||
</trim>
|
||||
<where>
|
||||
<if test="ew!=null">
|
||||
<if test="ew.entity!=null">
|
||||
HANDLE=#{ew.entity.handle}
|
||||
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
||||
<if test="ew.entity.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
|
||||
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
|
||||
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
||||
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
||||
</if>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteByMap">
|
||||
DELETE FROM PRINTER
|
||||
<if test="cm!=null and !cm.isEmpty">
|
||||
<where>
|
||||
<foreach collection="cm.keys" item="k" separator="AND">
|
||||
<if test="cm[k] != null">
|
||||
${k} = #{cm[${k}]}
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE FROM PRINTER
|
||||
<where>
|
||||
<if test="ew!=null">
|
||||
<if test="ew.entity!=null">
|
||||
<if test="ew.entity.handle!=null">
|
||||
HANDLE=#{ew.entity.handle}
|
||||
</if>
|
||||
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
||||
<if test="ew.entity.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
|
||||
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
|
||||
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
||||
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
||||
</if>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
||||
${ew.sqlSegment}
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<!-- BaseMapper标准查询/修改/删除 -->
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue