@@ -30,6 +30,9 @@ | |||
<poi.version>4.1.2</poi.version> | |||
<velocity.version>2.3</velocity.version> | |||
<jwt.version>0.9.1</jwt.version> | |||
<lombok.version>1.16.18</lombok.version> | |||
<hutool.version>5.5.4</hutool.version> | |||
</properties> | |||
<!-- 依赖声明 --> | |||
@@ -170,6 +173,27 @@ | |||
<version>${ruoyi.version}</version> | |||
</dependency> | |||
<!-- lombok --> | |||
<dependency> | |||
<groupId>org.projectlombok</groupId> | |||
<artifactId>lombok</artifactId> | |||
<version>${lombok.version}</version> | |||
</dependency> | |||
<!-- hutool --> | |||
<dependency> | |||
<groupId>cn.hutool</groupId> | |||
<artifactId>hutool-all</artifactId> | |||
<version>${hutool.version}</version> | |||
</dependency> | |||
<!-- 代理中心 --> | |||
<dependency> | |||
<groupId>com.ruoyi</groupId> | |||
<artifactId>ruoyi-agentcenter</artifactId> | |||
<version>${ruoyi.version}</version> | |||
</dependency> | |||
</dependencies> | |||
</dependencyManagement> | |||
@@ -180,12 +204,20 @@ | |||
<module>ruoyi-quartz</module> | |||
<module>ruoyi-generator</module> | |||
<module>ruoyi-common</module> | |||
<module>ruoyi-agentcenter</module> | |||
</modules> | |||
<packaging>pom</packaging> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.projectlombok</groupId> | |||
<artifactId>lombok</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>cn.hutool</groupId> | |||
<artifactId>hutool-all</artifactId> | |||
</dependency> | |||
</dependencies> | |||
<build> | |||
@@ -61,6 +61,12 @@ | |||
<artifactId>ruoyi-generator</artifactId> | |||
</dependency> | |||
<!-- 代理中心 --> | |||
<dependency> | |||
<groupId>com.ruoyi</groupId> | |||
<artifactId>ruoyi-agentcenter</artifactId> | |||
</dependency> | |||
</dependencies> | |||
<build> | |||
@@ -0,0 +1,106 @@ | |||
package com.ruoyi.web.controller.agentcenter; | |||
import java.util.List; | |||
import javax.servlet.http.HttpServletResponse; | |||
import org.springframework.security.access.prepost.PreAuthorize; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.PutMapping; | |||
import org.springframework.web.bind.annotation.DeleteMapping; | |||
import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import com.ruoyi.common.annotation.Log; | |||
import com.ruoyi.common.core.controller.BaseController; | |||
import com.ruoyi.common.core.domain.AjaxResult; | |||
import com.ruoyi.common.enums.BusinessType; | |||
import com.ruoyi.agentcenter.domain.TAgentTask; | |||
import com.ruoyi.agentcenter.service.ITAgentTaskService; | |||
import com.ruoyi.common.utils.poi.ExcelUtil; | |||
import com.ruoyi.common.core.page.TableDataInfo; | |||
/** | |||
* 任务清单Controller | |||
* | |||
* @author zhao | |||
* @date 2023-05-06 | |||
*/ | |||
@RestController | |||
@RequestMapping("/agentcenter/task") | |||
public class TAgentTaskController extends BaseController | |||
{ | |||
@Autowired | |||
private ITAgentTaskService tAgentTaskService; | |||
/** | |||
* 查询任务清单列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:list')") | |||
@GetMapping("/list") | |||
public TableDataInfo list(TAgentTask tAgentTask) | |||
{ | |||
startPage(); | |||
List<TAgentTask> list = tAgentTaskService.selectTAgentTaskList(tAgentTask); | |||
return getDataTable(list); | |||
} | |||
/** | |||
* 导出任务清单列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:export')") | |||
@Log(title = "任务清单", businessType = BusinessType.EXPORT) | |||
@PostMapping("/export") | |||
public void export(HttpServletResponse response, TAgentTask tAgentTask) | |||
{ | |||
List<TAgentTask> list = tAgentTaskService.selectTAgentTaskList(tAgentTask); | |||
ExcelUtil<TAgentTask> util = new ExcelUtil<TAgentTask>(TAgentTask.class); | |||
util.exportExcel(response, list, "任务清单数据"); | |||
} | |||
/** | |||
* 获取任务清单详细信息 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:query')") | |||
@GetMapping(value = "/get/{id}") | |||
public AjaxResult getInfo(@PathVariable("id") Long id) | |||
{ | |||
return success(tAgentTaskService.selectTAgentTaskById(id)); | |||
} | |||
/** | |||
* 新增任务清单 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:add')") | |||
@Log(title = "任务清单", businessType = BusinessType.INSERT) | |||
@PostMapping(value = "/add") | |||
public AjaxResult add(@RequestBody TAgentTask tAgentTask) | |||
{ | |||
tAgentTask.setCreateBy(getUsername()); | |||
return toAjax(tAgentTaskService.insertTAgentTask(tAgentTask)); | |||
} | |||
/** | |||
* 修改任务清单 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:edit')") | |||
@Log(title = "任务清单", businessType = BusinessType.UPDATE) | |||
@PutMapping(value = "/edit") | |||
public AjaxResult edit(@RequestBody TAgentTask tAgentTask) | |||
{ | |||
tAgentTask.setUpdateBy(getUsername()); | |||
return toAjax(tAgentTaskService.updateTAgentTask(tAgentTask)); | |||
} | |||
/** | |||
* 删除任务清单 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:remove')") | |||
@Log(title = "任务清单", businessType = BusinessType.DELETE) | |||
@DeleteMapping(value = "/remove/{id}") | |||
public AjaxResult remove(@PathVariable Long id) | |||
{ | |||
return toAjax(tAgentTaskService.deleteTAgentTaskById(id)); | |||
} | |||
} |
@@ -1,7 +1,7 @@ | |||
# 项目相关配置 | |||
ruoyi: | |||
# 名称 | |||
name: RuoYi | |||
name: NsGk_agentcenter | |||
# 版本 | |||
version: 3.8.5 | |||
# 版权年份 | |||
@@ -18,7 +18,7 @@ ruoyi: | |||
# 开发环境配置 | |||
server: | |||
# 服务器的HTTP端口,默认为8080 | |||
port: 8080 | |||
port: 8081 | |||
servlet: | |||
# 应用的访问路径 | |||
context-path: / | |||
@@ -74,7 +74,7 @@ spring: | |||
# 端口,默认为6379 | |||
port: 6379 | |||
# 数据库索引 | |||
database: 0 | |||
database: 1 | |||
# 密码 | |||
password: | |||
# 连接超时时间 | |||
@@ -97,7 +97,7 @@ token: | |||
# 令牌密钥 | |||
secret: abcdefghijklmnopqrstuvwxyz | |||
# 令牌有效期(默认30分钟) | |||
expireTime: 30 | |||
expireTime: 30000000 | |||
# MyBatis配置 | |||
mybatis: | |||
@@ -119,7 +119,7 @@ swagger: | |||
# 是否开启swagger | |||
enabled: true | |||
# 请求前缀 | |||
pathMapping: /dev-api | |||
pathMapping: /api | |||
# 防止XSS攻击 | |||
xss: | |||
@@ -0,0 +1,28 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
<parent> | |||
<artifactId>ruoyi</artifactId> | |||
<groupId>com.ruoyi</groupId> | |||
<version>3.8.5</version> | |||
</parent> | |||
<modelVersion>4.0.0</modelVersion> | |||
<artifactId>ruoyi-agentcenter</artifactId> | |||
<description> | |||
代理中心 | |||
</description> | |||
<dependencies> | |||
<!-- 通用工具--> | |||
<dependency> | |||
<groupId>com.ruoyi</groupId> | |||
<artifactId>ruoyi-common</artifactId> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -0,0 +1,127 @@ | |||
package com.ruoyi.agentcenter.domain; | |||
import java.math.BigDecimal; | |||
import java.util.Date; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import lombok.experimental.Accessors; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.ruoyi.common.annotation.Excel; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
/** | |||
* 任务清单对象 t_agent_task | |||
* | |||
* @author zhao | |||
* @date 2023-05-06 | |||
*/ | |||
@Data | |||
@Accessors(chain = true) | |||
public class TAgentTask extends BaseEntity | |||
{ | |||
private static final long serialVersionUID = 1L; | |||
/** id */ | |||
private Long id; | |||
/** 所属中心 字典 agent_center */ | |||
@Excel(name = "所属中心", dictType = "agent_center") | |||
private String agentCenter; | |||
/** 县代码 */ | |||
@Excel(name = "县代码") | |||
private String countyCode; | |||
/** 县名称 */ | |||
@Excel(name = "县名称") | |||
private String countyName; | |||
/** 镇代码 */ | |||
@Excel(name = "镇代码") | |||
private String townCode; | |||
/** 镇名称 */ | |||
@Excel(name = "镇名称") | |||
private String townName; | |||
/** 村代码 */ | |||
@Excel(name = "村代码") | |||
private String orgCode; | |||
/** 村名称 */ | |||
@Excel(name = "村名称") | |||
private String orgName; | |||
/** 账套数 */ | |||
@Excel(name = "账套数") | |||
private Integer bookCount; | |||
/** 凭证数 */ | |||
@Excel(name = "凭证数") | |||
private Integer voucherCount; | |||
/** 合同数 */ | |||
@Excel(name = "合同数") | |||
private Integer contractionCount; | |||
/** 资产数 */ | |||
@Excel(name = "资产数") | |||
private Integer assetCount; | |||
/** 任务总数 */ | |||
@Excel(name = "任务总数") | |||
private Integer allCount; | |||
/** 任务年度 */ | |||
@Excel(name = "任务年度") | |||
private String orderYear; | |||
/** 任务月份 */ | |||
@Excel(name = "任务月份") | |||
private String orderMonth; | |||
/** 任务状态 字典 agent_status (任务人全部完成后交任务的动作) */ | |||
@Excel(name = "任务状态", dictType = "agent_status") | |||
private String agentStatus; | |||
/** 分配主管(用user_name) */ | |||
@Excel(name = "分配主管") | |||
private String distributionChief; | |||
/** 分配时间 */ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@Excel(name = "分配时间", width = 30, dateFormat = "yyyy-MM-dd") | |||
private Date distributionDate; | |||
/** 任务截止日期 */ | |||
@Excel(name = "任务截止日期") | |||
private String endAt; | |||
/** 记账会计(即被分配人,用user_name) */ | |||
@Excel(name = "记账会计") | |||
private String handleAccount; | |||
/** 记账完成时间 */ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@Excel(name = "记账完成时间", width = 30, dateFormat = "yyyy-MM-dd") | |||
private Date handleDate; | |||
/** 审核会计(用user_name) */ | |||
@Excel(name = "审核会计(用user_name)") | |||
private String auditAccount; | |||
/** 审核时间 */ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd") | |||
private Date auditDate; | |||
/** 任务评分(分配主管来评价) */ | |||
@Excel(name = "任务评分") | |||
private BigDecimal taskScore; | |||
/** 任务评价 */ | |||
@Excel(name = "任务评价") | |||
private String taskAppraise; | |||
} |
@@ -0,0 +1,102 @@ | |||
package com.ruoyi.agentcenter.mapper; | |||
import java.util.List; | |||
import com.ruoyi.agentcenter.domain.TAgentTask; | |||
/** | |||
* 任务清单Mapper接口 | |||
* | |||
* @author zhao | |||
* @date 2023-05-06 | |||
*/ | |||
public interface TAgentTaskMapper | |||
{ | |||
/** | |||
* 查询任务清单 | |||
* | |||
* @param id 任务清单主键 | |||
* @return 任务清单 | |||
*/ | |||
public TAgentTask selectTAgentTaskById(Long id); | |||
/** | |||
* 查询任务清单列表 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 任务清单集合 | |||
*/ | |||
public List<TAgentTask> selectTAgentTaskList(TAgentTask tAgentTask); | |||
/** | |||
* 新增任务清单 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 结果 | |||
*/ | |||
public int insertTAgentTask(TAgentTask tAgentTask); | |||
/** | |||
* 批量新增任务清单 | |||
* | |||
* @param list 任务清单 | |||
* @return 结果 | |||
*/ | |||
public int insertTAgentTaskBatch(List<TAgentTask> list); | |||
/** | |||
* 批量修改 任务清单 | |||
* | |||
* @param list 任务清单 | |||
* @return 结果 | |||
*/ | |||
public int updateTAgentTaskBatch(List<TAgentTask> list); | |||
/** | |||
* 修改任务清单 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 结果 | |||
*/ | |||
public int updateTAgentTask(TAgentTask tAgentTask); | |||
/** | |||
* 删除任务清单 | |||
* | |||
* @param id 任务清单主键 | |||
* @return 结果 | |||
*/ | |||
public int deleteTAgentTaskById(Long id); | |||
/** | |||
* 批量删除任务清单 | |||
* | |||
* @param ids 需要删除的数据主键集合 | |||
* @return 结果 | |||
*/ | |||
public int deleteTAgentTaskByIds(Long[] ids); | |||
// Harm | |||
/** | |||
* 条件单条查询任务清单 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 任务清单条目 | |||
*/ | |||
public TAgentTask selectTAgentTask(TAgentTask tAgentTask); | |||
/** | |||
* 条件查询任务清单数量 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 任务清单数量 | |||
*/ | |||
public Long selectTAgentTaskCount(TAgentTask tAgentTask); | |||
/** | |||
* 条件查询任务清单是否存在 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 任务清单是否存在 | |||
*/ | |||
public int selectTAgentTaskExists(TAgentTask tAgentTask); | |||
} |
@@ -0,0 +1,102 @@ | |||
package com.ruoyi.agentcenter.service; | |||
import java.util.List; | |||
import com.ruoyi.agentcenter.domain.TAgentTask; | |||
/** | |||
* 任务清单Service接口 | |||
* | |||
* @author zhao | |||
* @date 2023-05-06 | |||
*/ | |||
public interface ITAgentTaskService | |||
{ | |||
/** | |||
* 查询任务清单 | |||
* | |||
* @param id 任务清单主键 | |||
* @return 任务清单 | |||
*/ | |||
public TAgentTask selectTAgentTaskById(Long id); | |||
/** | |||
* 查询任务清单列表 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 任务清单集合 | |||
*/ | |||
public List<TAgentTask> selectTAgentTaskList(TAgentTask tAgentTask); | |||
/** | |||
* 新增任务清单 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 结果 | |||
*/ | |||
public int insertTAgentTask(TAgentTask tAgentTask); | |||
/** | |||
* 批量新增任务清单 | |||
* | |||
* @param list 任务清单 | |||
* @return 结果 | |||
*/ | |||
public int insertTAgentTaskBatch(List<TAgentTask> list); | |||
/** | |||
* 修改任务清单 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 结果 | |||
*/ | |||
public int updateTAgentTask(TAgentTask tAgentTask); | |||
/** | |||
* 批量修改 任务清单 | |||
* | |||
* @param list 任务清单 | |||
* @return 结果 | |||
*/ | |||
public int updateTAgentTaskBatch(List<TAgentTask> list); | |||
/** | |||
* 批量删除任务清单 | |||
* | |||
* @param ids 需要删除的任务清单主键集合 | |||
* @return 结果 | |||
*/ | |||
public int deleteTAgentTaskByIds(Long[] ids); | |||
/** | |||
* 删除任务清单信息 | |||
* | |||
* @param id 任务清单主键 | |||
* @return 结果 | |||
*/ | |||
public int deleteTAgentTaskById(Long id); | |||
// Harm | |||
/** | |||
* 条件单条查询任务清单 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 任务清单条目 | |||
*/ | |||
public TAgentTask selectTAgentTask(TAgentTask tAgentTask); | |||
/** | |||
* 条件查询任务清单数量 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 任务清单数量 | |||
*/ | |||
public Long selectTAgentTaskCount(TAgentTask tAgentTask); | |||
/** | |||
* 条件查询任务清单是否存在 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 任务清单是否存在 | |||
*/ | |||
public boolean selectTAgentTaskExists(TAgentTask tAgentTask); | |||
} |
@@ -0,0 +1,164 @@ | |||
package com.ruoyi.agentcenter.service.impl; | |||
import java.util.List; | |||
import com.ruoyi.common.utils.DateUtils; | |||
import org.apache.commons.collections4.ListUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import com.ruoyi.agentcenter.mapper.TAgentTaskMapper; | |||
import com.ruoyi.agentcenter.domain.TAgentTask; | |||
import com.ruoyi.agentcenter.service.ITAgentTaskService; | |||
import org.springframework.transaction.annotation.Transactional; | |||
/** | |||
* 任务清单Service业务层处理 | |||
* | |||
* @author zhao | |||
* @date 2023-05-06 | |||
*/ | |||
@Service | |||
public class TAgentTaskServiceImpl implements ITAgentTaskService | |||
{ | |||
@Autowired | |||
private TAgentTaskMapper tAgentTaskMapper; | |||
/** | |||
* 查询任务清单 | |||
* | |||
* @param id 任务清单主键 | |||
* @return 任务清单 | |||
*/ | |||
@Override | |||
public TAgentTask selectTAgentTaskById(Long id) | |||
{ | |||
return tAgentTaskMapper.selectTAgentTaskById(id); | |||
} | |||
/** | |||
* 查询任务清单列表 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 任务清单 | |||
*/ | |||
@Override | |||
public List<TAgentTask> selectTAgentTaskList(TAgentTask tAgentTask) | |||
{ | |||
return tAgentTaskMapper.selectTAgentTaskList(tAgentTask); | |||
} | |||
/** | |||
* 新增任务清单 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public int insertTAgentTask(TAgentTask tAgentTask) | |||
{ | |||
tAgentTask.setCreateTime(DateUtils.getNowDate()); | |||
return tAgentTaskMapper.insertTAgentTask(tAgentTask); | |||
} | |||
/** | |||
* 批量新增任务清单 | |||
* | |||
* @param list 任务清单 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
@Transactional | |||
public int insertTAgentTaskBatch(List<TAgentTask> list){ | |||
List<List<TAgentTask>> splists = ListUtils.partition(list, 50); | |||
splists.forEach(splist->{ | |||
tAgentTaskMapper.insertTAgentTaskBatch(splist); | |||
}); | |||
return 1; | |||
} | |||
/** | |||
* 修改任务清单 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public int updateTAgentTask(TAgentTask tAgentTask) | |||
{ | |||
tAgentTask.setUpdateTime(DateUtils.getNowDate()); | |||
return tAgentTaskMapper.updateTAgentTask(tAgentTask); | |||
} | |||
/** | |||
* 批量修改 任务清单 | |||
* | |||
* @param list 任务清单 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
@Transactional | |||
public int updateTAgentTaskBatch(List<TAgentTask> list) { | |||
List<List<TAgentTask>> splists = ListUtils.partition(list, 50); | |||
splists.forEach(splist->{ | |||
tAgentTaskMapper.updateTAgentTaskBatch(splist); | |||
}); | |||
return 1; | |||
} | |||
/** | |||
* 批量删除任务清单 | |||
* | |||
* @param ids 需要删除的任务清单主键 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public int deleteTAgentTaskByIds(Long[] ids) | |||
{ | |||
return tAgentTaskMapper.deleteTAgentTaskByIds(ids); | |||
} | |||
/** | |||
* 删除任务清单信息 | |||
* | |||
* @param id 任务清单主键 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public int deleteTAgentTaskById(Long id) | |||
{ | |||
return tAgentTaskMapper.deleteTAgentTaskById(id); | |||
} | |||
// Harm | |||
/** | |||
* 单条条件查询任务清单 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 任务清单条目 | |||
*/ | |||
@Override | |||
public TAgentTask selectTAgentTask(TAgentTask tAgentTask) { | |||
return tAgentTaskMapper.selectTAgentTask(tAgentTask); | |||
} | |||
/** | |||
* 条件查询任务清单数量 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 任务清单数量 | |||
*/ | |||
@Override | |||
public Long selectTAgentTaskCount(TAgentTask tAgentTask) { | |||
return tAgentTaskMapper.selectTAgentTaskCount(tAgentTask); | |||
} | |||
/** | |||
* 条件查询任务清单是否存在 | |||
* | |||
* @param tAgentTask 任务清单 | |||
* @return 任务清单是否存在 | |||
*/ | |||
@Override | |||
public boolean selectTAgentTaskExists(TAgentTask tAgentTask) { | |||
return tAgentTaskMapper.selectTAgentTaskExists(tAgentTask) > 0; | |||
} | |||
} |
@@ -0,0 +1,399 @@ | |||
<?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.ruoyi.agentcenter.mapper.TAgentTaskMapper"> | |||
<resultMap type="TAgentTask" id="TAgentTaskResult"> | |||
<result property="id" column="id" /> | |||
<result property="agentCenter" column="agent_center" /> | |||
<result property="countyCode" column="county_code" /> | |||
<result property="countyName" column="county_name" /> | |||
<result property="townCode" column="town_code" /> | |||
<result property="townName" column="town_name" /> | |||
<result property="orgCode" column="org_code" /> | |||
<result property="orgName" column="org_name" /> | |||
<result property="bookCount" column="book_count" /> | |||
<result property="voucherCount" column="voucher_count" /> | |||
<result property="contractionCount" column="contraction_count" /> | |||
<result property="assetCount" column="asset_count" /> | |||
<result property="allCount" column="all_count" /> | |||
<result property="orderYear" column="order_year" /> | |||
<result property="orderMonth" column="order_month" /> | |||
<result property="agentStatus" column="agent_status" /> | |||
<result property="distributionChief" column="distribution_chief" /> | |||
<result property="distributionDate" column="distribution_date" /> | |||
<result property="endAt" column="end_at" /> | |||
<result property="handleAccount" column="handle_account" /> | |||
<result property="handleDate" column="handle_date" /> | |||
<result property="auditAccount" column="audit_account" /> | |||
<result property="auditDate" column="audit_date" /> | |||
<result property="taskScore" column="task_score" /> | |||
<result property="taskAppraise" column="task_appraise" /> | |||
<result property="createBy" column="create_by" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateBy" column="update_by" /> | |||
<result property="updateTime" column="update_time" /> | |||
</resultMap> | |||
<sql id="selectTAgentTaskVo"> | |||
select id, agent_center, county_code, county_name, town_code, town_name, org_code, org_name, book_count, voucher_count, contraction_count, asset_count, all_count, order_year, order_month, agent_status, distribution_chief, distribution_date, end_at, handle_account, handle_date, audit_account, audit_date, task_score, task_appraise, create_by, create_time, update_by, update_time from t_agent_task | |||
</sql> | |||
<!--条件查询--> | |||
<select id="selectTAgentTaskList" parameterType="TAgentTask" resultMap="TAgentTaskResult"> | |||
<include refid="selectTAgentTaskVo"/> | |||
<where> | |||
<if test="agentCenter != null and agentCenter != ''"> and agent_center = #{agentCenter}</if> | |||
<if test="countyCode != null and countyCode != ''"> and county_code = #{countyCode}</if> | |||
<if test="countyName != null and countyName != ''"> and county_name like concat('%', #{countyName}, '%')</if> | |||
<if test="townCode != null and townCode != ''"> and town_code = #{townCode}</if> | |||
<if test="townName != null and townName != ''"> and town_name like concat('%', #{townName}, '%')</if> | |||
<if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if> | |||
<if test="orgName != null and orgName != ''"> and org_name like concat('%', #{orgName}, '%')</if> | |||
<if test="bookCount != null "> and book_count = #{bookCount}</if> | |||
<if test="voucherCount != null "> and voucher_count = #{voucherCount}</if> | |||
<if test="contractionCount != null "> and contraction_count = #{contractionCount}</if> | |||
<if test="assetCount != null "> and asset_count = #{assetCount}</if> | |||
<if test="allCount != null "> and all_count = #{allCount}</if> | |||
<if test="orderYear != null and orderYear != ''"> and order_year = #{orderYear}</if> | |||
<if test="orderMonth != null and orderMonth != ''"> and order_month = #{orderMonth}</if> | |||
<if test="agentStatus != null and agentStatus != ''"> and agent_status = #{agentStatus}</if> | |||
<if test="distributionChief != null and distributionChief != ''"> and distribution_chief = #{distributionChief}</if> | |||
<if test="distributionDate != null "> and distribution_date = #{distributionDate}</if> | |||
<if test="endAt != null and endAt != ''"> and end_at = #{endAt}</if> | |||
<if test="handleAccount != null and handleAccount != ''"> and handle_account = #{handleAccount}</if> | |||
<if test="handleDate != null "> and handle_date = #{handleDate}</if> | |||
<if test="auditAccount != null and auditAccount != ''"> and audit_account = #{auditAccount}</if> | |||
<if test="auditDate != null "> and audit_date = #{auditDate}</if> | |||
<if test="taskScore != null "> and task_score = #{taskScore}</if> | |||
<if test="taskAppraise != null and taskAppraise != ''"> and task_appraise = #{taskAppraise}</if> | |||
</where> | |||
</select> | |||
<!--主键查询--> | |||
<select id="selectTAgentTaskById" parameterType="Long" resultMap="TAgentTaskResult"> | |||
<include refid="selectTAgentTaskVo"/> | |||
where id = #{id} | |||
</select> | |||
<!--新增--> | |||
<insert id="insertTAgentTask" parameterType="TAgentTask" useGeneratedKeys="true" keyProperty="id"> | |||
insert into t_agent_task | |||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||
<if test="agentCenter != null and agentCenter != ''">agent_center,</if> | |||
<if test="countyCode != null and countyCode != ''">county_code,</if> | |||
<if test="countyName != null and countyName != ''">county_name,</if> | |||
<if test="townCode != null and townCode != ''">town_code,</if> | |||
<if test="townName != null and townName != ''">town_name,</if> | |||
<if test="orgCode != null and orgCode != ''">org_code,</if> | |||
<if test="orgName != null and orgName != ''">org_name,</if> | |||
<if test="bookCount != null">book_count,</if> | |||
<if test="voucherCount != null">voucher_count,</if> | |||
<if test="contractionCount != null">contraction_count,</if> | |||
<if test="assetCount != null">asset_count,</if> | |||
<if test="allCount != null">all_count,</if> | |||
<if test="orderYear != null and orderYear != ''">order_year,</if> | |||
<if test="orderMonth != null and orderMonth != ''">order_month,</if> | |||
<if test="agentStatus != null and agentStatus != ''">agent_status,</if> | |||
<if test="distributionChief != null">distribution_chief,</if> | |||
<if test="distributionDate != null">distribution_date,</if> | |||
<if test="endAt != null">end_at,</if> | |||
<if test="handleAccount != null">handle_account,</if> | |||
<if test="handleDate != null">handle_date,</if> | |||
<if test="auditAccount != null">audit_account,</if> | |||
<if test="auditDate != null">audit_date,</if> | |||
<if test="taskScore != null">task_score,</if> | |||
<if test="taskAppraise != null">task_appraise,</if> | |||
<if test="createBy != null">create_by,</if> | |||
<if test="createTime != null">create_time,</if> | |||
<if test="updateBy != null">update_by,</if> | |||
<if test="updateTime != null">update_time,</if> | |||
</trim> | |||
<trim prefix="values (" suffix=")" suffixOverrides=","> | |||
<if test="agentCenter != null and agentCenter != ''">#{agentCenter},</if> | |||
<if test="countyCode != null and countyCode != ''">#{countyCode},</if> | |||
<if test="countyName != null and countyName != ''">#{countyName},</if> | |||
<if test="townCode != null and townCode != ''">#{townCode},</if> | |||
<if test="townName != null and townName != ''">#{townName},</if> | |||
<if test="orgCode != null and orgCode != ''">#{orgCode},</if> | |||
<if test="orgName != null and orgName != ''">#{orgName},</if> | |||
<if test="bookCount != null">#{bookCount},</if> | |||
<if test="voucherCount != null">#{voucherCount},</if> | |||
<if test="contractionCount != null">#{contractionCount},</if> | |||
<if test="assetCount != null">#{assetCount},</if> | |||
<if test="allCount != null">#{allCount},</if> | |||
<if test="orderYear != null and orderYear != ''">#{orderYear},</if> | |||
<if test="orderMonth != null and orderMonth != ''">#{orderMonth},</if> | |||
<if test="agentStatus != null and agentStatus != ''">#{agentStatus},</if> | |||
<if test="distributionChief != null">#{distributionChief},</if> | |||
<if test="distributionDate != null">#{distributionDate},</if> | |||
<if test="endAt != null">#{endAt},</if> | |||
<if test="handleAccount != null">#{handleAccount},</if> | |||
<if test="handleDate != null">#{handleDate},</if> | |||
<if test="auditAccount != null">#{auditAccount},</if> | |||
<if test="auditDate != null">#{auditDate},</if> | |||
<if test="taskScore != null">#{taskScore},</if> | |||
<if test="taskAppraise != null">#{taskAppraise},</if> | |||
<if test="createBy != null">#{createBy},</if> | |||
<if test="createTime != null">#{createTime},</if> | |||
<if test="updateBy != null">#{updateBy},</if> | |||
<if test="updateTime != null">#{updateTime},</if> | |||
</trim> | |||
</insert> | |||
<!--批量新增--> | |||
<insert id="insertTAgentTaskBatch" parameterType="list" useGeneratedKeys="true" keyProperty="id"> | |||
insert into t_agent_task | |||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||
agent_center, | |||
county_code, | |||
county_name, | |||
town_code, | |||
town_name, | |||
org_code, | |||
org_name, | |||
book_count, | |||
voucher_count, | |||
contraction_count, | |||
asset_count, | |||
all_count, | |||
order_year, | |||
order_month, | |||
agent_status, | |||
distribution_chief, | |||
distribution_date, | |||
end_at, | |||
handle_account, | |||
handle_date, | |||
audit_account, | |||
audit_date, | |||
task_score, | |||
task_appraise, | |||
create_by, | |||
create_time, | |||
update_by, | |||
update_time, | |||
</trim> | |||
values | |||
<foreach item="item" collection="list" separator="," > | |||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||
#{item.agentCenter}, | |||
#{item.countyCode}, | |||
#{item.countyName}, | |||
#{item.townCode}, | |||
#{item.townName}, | |||
#{item.orgCode}, | |||
#{item.orgName}, | |||
#{item.bookCount}, | |||
#{item.voucherCount}, | |||
#{item.contractionCount}, | |||
#{item.assetCount}, | |||
#{item.allCount}, | |||
#{item.orderYear}, | |||
#{item.orderMonth}, | |||
#{item.agentStatus}, | |||
#{item.distributionChief}, | |||
#{item.distributionDate}, | |||
#{item.endAt}, | |||
#{item.handleAccount}, | |||
#{item.handleDate}, | |||
#{item.auditAccount}, | |||
#{item.auditDate}, | |||
#{item.taskScore}, | |||
#{item.taskAppraise}, | |||
#{item.createBy}, | |||
#{item.createTime}, | |||
#{item.updateBy}, | |||
#{item.updateTime}, | |||
</trim> | |||
</foreach> | |||
</insert> | |||
<!--更新--> | |||
<update id="updateTAgentTask" parameterType="TAgentTask"> | |||
update t_agent_task | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="agentCenter != null and agentCenter != ''">agent_center = #{agentCenter},</if> | |||
<if test="countyCode != null and countyCode != ''">county_code = #{countyCode},</if> | |||
<if test="countyName != null and countyName != ''">county_name = #{countyName},</if> | |||
<if test="townCode != null and townCode != ''">town_code = #{townCode},</if> | |||
<if test="townName != null and townName != ''">town_name = #{townName},</if> | |||
<if test="orgCode != null and orgCode != ''">org_code = #{orgCode},</if> | |||
<if test="orgName != null and orgName != ''">org_name = #{orgName},</if> | |||
<if test="bookCount != null">book_count = #{bookCount},</if> | |||
<if test="voucherCount != null">voucher_count = #{voucherCount},</if> | |||
<if test="contractionCount != null">contraction_count = #{contractionCount},</if> | |||
<if test="assetCount != null">asset_count = #{assetCount},</if> | |||
<if test="allCount != null">all_count = #{allCount},</if> | |||
<if test="orderYear != null and orderYear != ''">order_year = #{orderYear},</if> | |||
<if test="orderMonth != null and orderMonth != ''">order_month = #{orderMonth},</if> | |||
<if test="agentStatus != null and agentStatus != ''">agent_status = #{agentStatus},</if> | |||
<if test="distributionChief != null">distribution_chief = #{distributionChief},</if> | |||
<if test="distributionDate != null">distribution_date = #{distributionDate},</if> | |||
<if test="endAt != null">end_at = #{endAt},</if> | |||
<if test="handleAccount != null">handle_account = #{handleAccount},</if> | |||
<if test="handleDate != null">handle_date = #{handleDate},</if> | |||
<if test="auditAccount != null">audit_account = #{auditAccount},</if> | |||
<if test="auditDate != null">audit_date = #{auditDate},</if> | |||
<if test="taskScore != null">task_score = #{taskScore},</if> | |||
<if test="taskAppraise != null">task_appraise = #{taskAppraise},</if> | |||
<if test="createBy != null">create_by = #{createBy},</if> | |||
<if test="createTime != null">create_time = #{createTime},</if> | |||
<if test="updateBy != null">update_by = #{updateBy},</if> | |||
<if test="updateTime != null">update_time = #{updateTime},</if> | |||
<if test="params != null and params.__UPDATE != null"><foreach collection="params.__UPDATE" item="val" index="col">`${col}` = #{val},</foreach></if> | |||
</trim> | |||
where id = #{id} | |||
</update> | |||
<!--批量更新--> | |||
<update id="updateTAgentTaskBatch" parameterType="list" > | |||
<foreach collection="list" item="item" index="index" open="" close="" separator=";"> | |||
update t_agent_task | |||
<set> | |||
<if test="item.agentCenter != null and item.agentCenter != ''">agent_center = #{item.agentCenter},</if> | |||
<if test="item.countyCode != null and item.countyCode != ''">county_code = #{item.countyCode},</if> | |||
<if test="item.countyName != null and item.countyName != ''">county_name = #{item.countyName},</if> | |||
<if test="item.townCode != null and item.townCode != ''">town_code = #{item.townCode},</if> | |||
<if test="item.townName != null and item.townName != ''">town_name = #{item.townName},</if> | |||
<if test="item.orgCode != null and item.orgCode != ''">org_code = #{item.orgCode},</if> | |||
<if test="item.orgName != null and item.orgName != ''">org_name = #{item.orgName},</if> | |||
<if test="item.bookCount != null">book_count = #{item.bookCount},</if> | |||
<if test="item.voucherCount != null">voucher_count = #{item.voucherCount},</if> | |||
<if test="item.contractionCount != null">contraction_count = #{item.contractionCount},</if> | |||
<if test="item.assetCount != null">asset_count = #{item.assetCount},</if> | |||
<if test="item.allCount != null">all_count = #{item.allCount},</if> | |||
<if test="item.orderYear != null and item.orderYear != ''">order_year = #{item.orderYear},</if> | |||
<if test="item.orderMonth != null and item.orderMonth != ''">order_month = #{item.orderMonth},</if> | |||
<if test="item.agentStatus != null and item.agentStatus != ''">agent_status = #{item.agentStatus},</if> | |||
<if test="item.distributionChief != null">distribution_chief = #{item.distributionChief},</if> | |||
<if test="item.distributionDate != null">distribution_date = #{item.distributionDate},</if> | |||
<if test="item.endAt != null">end_at = #{item.endAt},</if> | |||
<if test="item.handleAccount != null">handle_account = #{item.handleAccount},</if> | |||
<if test="item.handleDate != null">handle_date = #{item.handleDate},</if> | |||
<if test="item.auditAccount != null">audit_account = #{item.auditAccount},</if> | |||
<if test="item.auditDate != null">audit_date = #{item.auditDate},</if> | |||
<if test="item.taskScore != null">task_score = #{item.taskScore},</if> | |||
<if test="item.taskAppraise != null">task_appraise = #{item.taskAppraise},</if> | |||
<if test="item.createBy != null">create_by = #{item.createBy},</if> | |||
<if test="item.createTime != null">create_time = #{item.createTime},</if> | |||
<if test="item.updateBy != null">update_by = #{item.updateBy},</if> | |||
<if test="item.updateTime != null">update_time = #{item.updateTime},</if> | |||
<if test="item.params != null and item.params.__UPDATE != null"><foreach collection="item.params.__UPDATE" item="val" index="col">`${col}` = #{val},</foreach></if> | |||
</set> | |||
where id = #{item.id} | |||
</foreach> | |||
</update> | |||
<!--主键删除--> | |||
<delete id="deleteTAgentTaskById" parameterType="Long"> | |||
delete from t_agent_task where id = #{id} | |||
</delete> | |||
<!--主键批量删除--> | |||
<delete id="deleteTAgentTaskByIds" parameterType="String"> | |||
delete from t_agent_task where id in | |||
<foreach item="id" collection="array" open="(" separator="," close=")"> | |||
#{id} | |||
</foreach> | |||
</delete> | |||
<!-- Harm --> | |||
<!--单条条件查询--> | |||
<select id="selectTAgentTask" parameterType="TAgentTask" resultMap="TAgentTaskResult"> | |||
<include refid="selectTAgentTaskVo"/> | |||
<where> | |||
<if test="agentCenter != null and agentCenter != ''"> and agent_center = #{agentCenter}</if> | |||
<if test="countyCode != null and countyCode != ''"> and county_code = #{countyCode}</if> | |||
<if test="countyName != null and countyName != ''"> and county_name like concat('%', #{countyName}, '%')</if> | |||
<if test="townCode != null and townCode != ''"> and town_code = #{townCode}</if> | |||
<if test="townName != null and townName != ''"> and town_name like concat('%', #{townName}, '%')</if> | |||
<if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if> | |||
<if test="orgName != null and orgName != ''"> and org_name like concat('%', #{orgName}, '%')</if> | |||
<if test="bookCount != null "> and book_count = #{bookCount}</if> | |||
<if test="voucherCount != null "> and voucher_count = #{voucherCount}</if> | |||
<if test="contractionCount != null "> and contraction_count = #{contractionCount}</if> | |||
<if test="assetCount != null "> and asset_count = #{assetCount}</if> | |||
<if test="allCount != null "> and all_count = #{allCount}</if> | |||
<if test="orderYear != null and orderYear != ''"> and order_year = #{orderYear}</if> | |||
<if test="orderMonth != null and orderMonth != ''"> and order_month = #{orderMonth}</if> | |||
<if test="agentStatus != null and agentStatus != ''"> and agent_status = #{agentStatus}</if> | |||
<if test="distributionChief != null and distributionChief != ''"> and distribution_chief = #{distributionChief}</if> | |||
<if test="distributionDate != null "> and distribution_date = #{distributionDate}</if> | |||
<if test="endAt != null and endAt != ''"> and end_at = #{endAt}</if> | |||
<if test="handleAccount != null and handleAccount != ''"> and handle_account = #{handleAccount}</if> | |||
<if test="handleDate != null "> and handle_date = #{handleDate}</if> | |||
<if test="auditAccount != null and auditAccount != ''"> and audit_account = #{auditAccount}</if> | |||
<if test="auditDate != null "> and audit_date = #{auditDate}</if> | |||
<if test="taskScore != null "> and task_score = #{taskScore}</if> | |||
<if test="taskAppraise != null and taskAppraise != ''"> and task_appraise = #{taskAppraise}</if> | |||
</where> | |||
limit 1 | |||
</select> | |||
<!--条件查询数量--> | |||
<select id="selectTAgentTaskCount" parameterType="TAgentTask" resultType="Long"> | |||
select count(*) from t_agent_task | |||
<where> | |||
<if test="agentCenter != null and agentCenter != ''"> and agent_center = #{agentCenter}</if> | |||
<if test="countyCode != null and countyCode != ''"> and county_code = #{countyCode}</if> | |||
<if test="countyName != null and countyName != ''"> and county_name like concat('%', #{countyName}, '%')</if> | |||
<if test="townCode != null and townCode != ''"> and town_code = #{townCode}</if> | |||
<if test="townName != null and townName != ''"> and town_name like concat('%', #{townName}, '%')</if> | |||
<if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if> | |||
<if test="orgName != null and orgName != ''"> and org_name like concat('%', #{orgName}, '%')</if> | |||
<if test="bookCount != null "> and book_count = #{bookCount}</if> | |||
<if test="voucherCount != null "> and voucher_count = #{voucherCount}</if> | |||
<if test="contractionCount != null "> and contraction_count = #{contractionCount}</if> | |||
<if test="assetCount != null "> and asset_count = #{assetCount}</if> | |||
<if test="allCount != null "> and all_count = #{allCount}</if> | |||
<if test="orderYear != null and orderYear != ''"> and order_year = #{orderYear}</if> | |||
<if test="orderMonth != null and orderMonth != ''"> and order_month = #{orderMonth}</if> | |||
<if test="agentStatus != null and agentStatus != ''"> and agent_status = #{agentStatus}</if> | |||
<if test="distributionChief != null and distributionChief != ''"> and distribution_chief = #{distributionChief}</if> | |||
<if test="distributionDate != null "> and distribution_date = #{distributionDate}</if> | |||
<if test="endAt != null and endAt != ''"> and end_at = #{endAt}</if> | |||
<if test="handleAccount != null and handleAccount != ''"> and handle_account = #{handleAccount}</if> | |||
<if test="handleDate != null "> and handle_date = #{handleDate}</if> | |||
<if test="auditAccount != null and auditAccount != ''"> and audit_account = #{auditAccount}</if> | |||
<if test="auditDate != null "> and audit_date = #{auditDate}</if> | |||
<if test="taskScore != null "> and task_score = #{taskScore}</if> | |||
<if test="taskAppraise != null and taskAppraise != ''"> and task_appraise = #{taskAppraise}</if> | |||
</where> | |||
</select> | |||
<!--条件查询是否存在--> | |||
<select id="selectTAgentTaskExists" parameterType="TAgentTask" resultType="int"> | |||
select exists ( | |||
select 1 from t_agent_task | |||
<where> | |||
<if test="agentCenter != null and agentCenter != ''"> and agent_center = #{agentCenter}</if> | |||
<if test="countyCode != null and countyCode != ''"> and county_code = #{countyCode}</if> | |||
<if test="countyName != null and countyName != ''"> and county_name like concat('%', #{countyName}, '%')</if> | |||
<if test="townCode != null and townCode != ''"> and town_code = #{townCode}</if> | |||
<if test="townName != null and townName != ''"> and town_name like concat('%', #{townName}, '%')</if> | |||
<if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if> | |||
<if test="orgName != null and orgName != ''"> and org_name like concat('%', #{orgName}, '%')</if> | |||
<if test="bookCount != null "> and book_count = #{bookCount}</if> | |||
<if test="voucherCount != null "> and voucher_count = #{voucherCount}</if> | |||
<if test="contractionCount != null "> and contraction_count = #{contractionCount}</if> | |||
<if test="assetCount != null "> and asset_count = #{assetCount}</if> | |||
<if test="allCount != null "> and all_count = #{allCount}</if> | |||
<if test="orderYear != null and orderYear != ''"> and order_year = #{orderYear}</if> | |||
<if test="orderMonth != null and orderMonth != ''"> and order_month = #{orderMonth}</if> | |||
<if test="agentStatus != null and agentStatus != ''"> and agent_status = #{agentStatus}</if> | |||
<if test="distributionChief != null and distributionChief != ''"> and distribution_chief = #{distributionChief}</if> | |||
<if test="distributionDate != null "> and distribution_date = #{distributionDate}</if> | |||
<if test="endAt != null and endAt != ''"> and end_at = #{endAt}</if> | |||
<if test="handleAccount != null and handleAccount != ''"> and handle_account = #{handleAccount}</if> | |||
<if test="handleDate != null "> and handle_date = #{handleDate}</if> | |||
<if test="auditAccount != null and auditAccount != ''"> and audit_account = #{auditAccount}</if> | |||
<if test="auditDate != null "> and audit_date = #{auditDate}</if> | |||
<if test="taskScore != null "> and task_score = #{taskScore}</if> | |||
<if test="taskAppraise != null and taskAppraise != ''"> and task_appraise = #{taskAppraise}</if> | |||
</where> | |||
limit 1 | |||
) | |||
</select> | |||
</mapper> |
@@ -3,6 +3,8 @@ package com.ruoyi.common.core.controller; | |||
import java.beans.PropertyEditorSupport; | |||
import java.util.Date; | |||
import java.util.List; | |||
import com.ruoyi.common.core.domain.entity.SysUser; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.web.bind.WebDataBinder; | |||
@@ -199,4 +201,9 @@ public class BaseController | |||
{ | |||
return getLoginUser().getUsername(); | |||
} | |||
protected SysUser USER() | |||
{ | |||
return getLoginUser().getUser(); | |||
} | |||
} |
@@ -206,7 +206,7 @@ public class GenController extends BaseController | |||
response.reset(); | |||
response.addHeader("Access-Control-Allow-Origin", "*"); | |||
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); | |||
response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\""); | |||
response.setHeader("Content-Disposition", "attachment; filename=\"nsgk.zip\""); | |||
response.addHeader("Content-Length", "" + data.length); | |||
response.setContentType("application/octet-stream; charset=UTF-8"); | |||
IOUtils.write(data, response.getOutputStream()); | |||
@@ -1,10 +1,10 @@ | |||
# 代码生成 | |||
gen: | |||
# 作者 | |||
author: ruoyi | |||
author: nsgk | |||
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool | |||
packageName: com.ruoyi.system | |||
packageName: com.ruoyi.agentcenter | |||
# 自动去除表前缀,默认是false | |||
autoRemovePre: false | |||
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔) | |||
tablePrefix: sys_ | |||
tablePrefix: t_ |
@@ -1,4 +1,4 @@ | |||
package ${packageName}.controller; | |||
package com.ruoyi.web.controller.${moduleName}; | |||
import java.util.List; | |||
import javax.servlet.http.HttpServletResponse; | |||
@@ -74,7 +74,7 @@ public class ${ClassName}Controller extends BaseController | |||
* 获取${functionName}详细信息 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')") | |||
@GetMapping(value = "/{${pkColumn.javaField}}") | |||
@GetMapping(value = "/get/{${pkColumn.javaField}}") | |||
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) | |||
{ | |||
return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField})); | |||
@@ -85,9 +85,10 @@ public class ${ClassName}Controller extends BaseController | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')") | |||
@Log(title = "${functionName}", businessType = BusinessType.INSERT) | |||
@PostMapping | |||
@PostMapping(value = "/add") | |||
public AjaxResult add(@RequestBody ${ClassName} ${className}) | |||
{ | |||
${className}.setCreateBy(getUsername()); | |||
return toAjax(${className}Service.insert${ClassName}(${className})); | |||
} | |||
@@ -96,9 +97,10 @@ public class ${ClassName}Controller extends BaseController | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')") | |||
@Log(title = "${functionName}", businessType = BusinessType.UPDATE) | |||
@PutMapping | |||
@PutMapping(value = "/edit") | |||
public AjaxResult edit(@RequestBody ${ClassName} ${className}) | |||
{ | |||
${className}.setUpdateBy(getUsername()); | |||
return toAjax(${className}Service.update${ClassName}(${className})); | |||
} | |||
@@ -107,9 +109,9 @@ public class ${ClassName}Controller extends BaseController | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')") | |||
@Log(title = "${functionName}", businessType = BusinessType.DELETE) | |||
@DeleteMapping("/{${pkColumn.javaField}s}") | |||
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) | |||
@DeleteMapping(value = "/remove/{${pkColumn.javaField}}") | |||
public AjaxResult remove(@PathVariable ${pkColumn.javaType} ${pkColumn.javaField}) | |||
{ | |||
return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s)); | |||
return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField})); | |||
} | |||
} |
@@ -3,6 +3,8 @@ package ${packageName}.domain; | |||
#foreach ($import in $importList) | |||
import ${import}; | |||
#end | |||
import lombok.Data; | |||
import lombok.experimental.Accessors; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.ruoyi.common.annotation.Excel; | |||
@@ -23,6 +25,8 @@ import com.ruoyi.common.core.domain.TreeEntity; | |||
#elseif($table.tree) | |||
#set($Entity="TreeEntity") | |||
#end | |||
@Data | |||
@Accessors(chain = true) | |||
public class ${ClassName} extends ${Entity} | |||
{ | |||
private static final long serialVersionUID = 1L; | |||
@@ -55,24 +59,6 @@ public class ${ClassName} extends ${Entity} | |||
private List<${subClassName}> ${subclassName}List; | |||
#end | |||
#foreach ($column in $columns) | |||
#if(!$table.isSuperColumn($column.javaField)) | |||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) | |||
#set($AttrName=$column.javaField) | |||
#else | |||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | |||
#end | |||
public void set${AttrName}($column.javaType $column.javaField) | |||
{ | |||
this.$column.javaField = $column.javaField; | |||
} | |||
public $column.javaType get${AttrName}() | |||
{ | |||
return $column.javaField; | |||
} | |||
#end | |||
#end | |||
#if($table.sub) | |||
public List<${subClassName}> get${subClassName}List() | |||
@@ -86,20 +72,4 @@ public class ${ClassName} extends ${Entity} | |||
} | |||
#end | |||
@Override | |||
public String toString() { | |||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |||
#foreach ($column in $columns) | |||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) | |||
#set($AttrName=$column.javaField) | |||
#else | |||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | |||
#end | |||
.append("${column.javaField}", get${AttrName}()) | |||
#end | |||
#if($table.sub) | |||
.append("${subclassName}List", get${subClassName}List()) | |||
#end | |||
.toString(); | |||
} | |||
} |
@@ -38,6 +38,22 @@ public interface ${ClassName}Mapper | |||
*/ | |||
public int insert${ClassName}(${ClassName} ${className}); | |||
/** | |||
* 批量新增${functionName} | |||
* | |||
* @param list ${functionName} | |||
* @return 结果 | |||
*/ | |||
public int insert${ClassName}Batch(List<${ClassName}> list); | |||
/** | |||
* 批量修改 ${functionName} | |||
* | |||
* @param list ${functionName} | |||
* @return 结果 | |||
*/ | |||
public int update${ClassName}Batch(List<${ClassName}> list); | |||
/** | |||
* 修改${functionName} | |||
* | |||
@@ -88,4 +104,29 @@ public interface ${ClassName}Mapper | |||
*/ | |||
public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField}); | |||
#end | |||
// Harm | |||
/** | |||
* 条件单条查询${functionName} | |||
* | |||
* @param ${className} ${functionName} | |||
* @return ${functionName}条目 | |||
*/ | |||
public ${ClassName} select${ClassName}(${ClassName} ${className}); | |||
/** | |||
* 条件查询${functionName}数量 | |||
* | |||
* @param ${className} ${functionName} | |||
* @return ${functionName}数量 | |||
*/ | |||
public Long select${ClassName}Count(${ClassName} ${className}); | |||
/** | |||
* 条件查询${functionName}是否存在 | |||
* | |||
* @param ${className} ${functionName} | |||
* @return ${functionName}是否存在 | |||
*/ | |||
public int select${ClassName}Exists(${ClassName} ${className}); | |||
} |
@@ -35,6 +35,14 @@ public interface I${ClassName}Service | |||
*/ | |||
public int insert${ClassName}(${ClassName} ${className}); | |||
/** | |||
* 批量新增${functionName} | |||
* | |||
* @param list ${functionName} | |||
* @return 结果 | |||
*/ | |||
public int insert${ClassName}Batch(List<${ClassName}> list); | |||
/** | |||
* 修改${functionName} | |||
* | |||
@@ -43,6 +51,14 @@ public interface I${ClassName}Service | |||
*/ | |||
public int update${ClassName}(${ClassName} ${className}); | |||
/** | |||
* 批量修改 ${functionName} | |||
* | |||
* @param list ${functionName} | |||
* @return 结果 | |||
*/ | |||
public int update${ClassName}Batch(List<${ClassName}> list); | |||
/** | |||
* 批量删除${functionName} | |||
* | |||
@@ -58,4 +74,29 @@ public interface I${ClassName}Service | |||
* @return 结果 | |||
*/ | |||
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); | |||
// Harm | |||
/** | |||
* 条件单条查询${functionName} | |||
* | |||
* @param ${className} ${functionName} | |||
* @return ${functionName}条目 | |||
*/ | |||
public ${ClassName} select${ClassName}(${ClassName} ${className}); | |||
/** | |||
* 条件查询${functionName}数量 | |||
* | |||
* @param ${className} ${functionName} | |||
* @return ${functionName}数量 | |||
*/ | |||
public Long select${ClassName}Count(${ClassName} ${className}); | |||
/** | |||
* 条件查询${functionName}是否存在 | |||
* | |||
* @param ${className} ${functionName} | |||
* @return ${functionName}是否存在 | |||
*/ | |||
public boolean select${ClassName}Exists(${ClassName} ${className}); | |||
} |
@@ -9,10 +9,11 @@ import com.ruoyi.common.utils.DateUtils; | |||
#end | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import org.apache.commons.collections4.ListUtils; | |||
#if($table.sub) | |||
import java.util.ArrayList; | |||
import com.ruoyi.common.utils.StringUtils; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import ${packageName}.domain.${subClassName}; | |||
#end | |||
import ${packageName}.mapper.${ClassName}Mapper; | |||
@@ -81,6 +82,22 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service | |||
#end | |||
} | |||
/** | |||
* 批量新增${functionName} | |||
* | |||
* @param list ${functionName} | |||
* @return 结果 | |||
*/ | |||
@Override | |||
@Transactional | |||
public int insert${ClassName}Batch(List<${ClassName}> list){ | |||
List<List<${ClassName}>> splists = ListUtils.partition(list, 50); | |||
splists.forEach(splist->{ | |||
${className}Mapper.insert${ClassName}Batch(splist); | |||
}); | |||
return 1; | |||
} | |||
/** | |||
* 修改${functionName} | |||
* | |||
@@ -105,6 +122,22 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service | |||
return ${className}Mapper.update${ClassName}(${className}); | |||
} | |||
/** | |||
* 批量修改 ${functionName} | |||
* | |||
* @param list ${functionName} | |||
* @return 结果 | |||
*/ | |||
@Override | |||
@Transactional | |||
public int update${ClassName}Batch(List<${ClassName}> list) { | |||
List<List<${ClassName}>> splists = ListUtils.partition(list, 50); | |||
splists.forEach(splist->{ | |||
${className}Mapper.update${ClassName}Batch(splist); | |||
}); | |||
return 1; | |||
} | |||
/** | |||
* 批量删除${functionName} | |||
* | |||
@@ -166,4 +199,38 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service | |||
} | |||
} | |||
#end | |||
// Harm | |||
/** | |||
* 单条条件查询${functionName} | |||
* | |||
* @param ${className} ${functionName} | |||
* @return ${functionName}条目 | |||
*/ | |||
@Override | |||
public ${ClassName} select${ClassName}(${ClassName} ${className}) { | |||
return ${className}Mapper.select${ClassName}(${className}); | |||
} | |||
/** | |||
* 条件查询${functionName}数量 | |||
* | |||
* @param ${className} ${functionName} | |||
* @return ${functionName}数量 | |||
*/ | |||
@Override | |||
public Long select${ClassName}Count(${ClassName} ${className}) { | |||
return ${className}Mapper.select${ClassName}Count(${className}); | |||
} | |||
/** | |||
* 条件查询${functionName}是否存在 | |||
* | |||
* @param ${className} ${functionName} | |||
* @return ${functionName}是否存在 | |||
*/ | |||
@Override | |||
public boolean select${ClassName}Exists(${ClassName} ${className}) { | |||
return ${className}Mapper.select${ClassName}Exists(${className}) > 0; | |||
} | |||
} |
@@ -1,5 +1,13 @@ | |||
import request from '@/utils/request' | |||
/* ${functionName} JSON | |||
{ | |||
#foreach ($column in $columns) | |||
"${column.javaField}": "${column.columnComment}"#if($velocityCount != $columns.size()),#end // ${column.javaType} | |||
#end | |||
} | |||
*/ | |||
// 查询${functionName}列表 | |||
export function list${BusinessName}(query) { | |||
return request({ | |||
@@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName} | |||
</sql> | |||
<!--条件查询--> | |||
<select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result"> | |||
<include refid="select${ClassName}Vo"/> | |||
<where> | |||
@@ -58,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</where> | |||
</select> | |||
<!--主键查询--> | |||
<select id="select${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end"> | |||
#if($table.crud || $table.tree) | |||
<include refid="select${ClassName}Vo"/> | |||
@@ -72,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
#end | |||
</select> | |||
<!--新增--> | |||
<insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end> | |||
insert into ${tableName} | |||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||
@@ -90,6 +93,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</trim> | |||
</insert> | |||
<!--批量新增--> | |||
<insert id="insert${ClassName}Batch" parameterType="list" #if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end> | |||
insert into ${tableName} | |||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||
#foreach($column in $columns) | |||
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) | |||
$column.columnName, | |||
#end | |||
#end | |||
</trim> | |||
values | |||
<foreach item="item" collection="list" separator="," > | |||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||
#foreach($column in $columns) | |||
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) | |||
#{item.$column.javaField}, | |||
#end | |||
#end | |||
</trim> | |||
</foreach> | |||
</insert> | |||
<!--更新--> | |||
<update id="update${ClassName}" parameterType="${ClassName}"> | |||
update ${tableName} | |||
<trim prefix="SET" suffixOverrides=","> | |||
@@ -98,14 +124,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if> | |||
#end | |||
#end | |||
<if test="params != null and params.__UPDATE != null"><foreach collection="params.__UPDATE" item="val" index="col">`${col}` = #{val},</foreach></if> | |||
</trim> | |||
where ${pkColumn.columnName} = #{${pkColumn.javaField}} | |||
</update> | |||
<!--批量更新--> | |||
<update id="update${ClassName}Batch" parameterType="list" > | |||
<foreach collection="list" item="item" index="index" open="" close="" separator=";"> | |||
update ${tableName} | |||
<set> | |||
#foreach($column in $columns) | |||
#if($column.columnName != $pkColumn.columnName) | |||
<if test="item.$column.javaField != null#if($column.javaType == 'String' && $column.required) and item.$column.javaField != ''#end">$column.columnName = #{item.$column.javaField},</if> | |||
#end | |||
#end | |||
<if test="item.params != null and item.params.__UPDATE != null"><foreach collection="item.params.__UPDATE" item="val" index="col">`${col}` = #{val},</foreach></if> | |||
</set> | |||
where ${pkColumn.columnName} = #{item.${pkColumn.javaField}} | |||
</foreach> | |||
</update> | |||
<!--主键删除--> | |||
<delete id="delete${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}"> | |||
delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}} | |||
</delete> | |||
<!--主键批量删除--> | |||
<delete id="delete${ClassName}By${pkColumn.capJavaField}s" parameterType="String"> | |||
delete from ${tableName} where ${pkColumn.columnName} in | |||
<foreach item="${pkColumn.javaField}" collection="array" open="(" separator="," close=")"> | |||
@@ -114,6 +159,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</delete> | |||
#if($table.sub) | |||
<!--按主表N个主键批量删除子表--> | |||
<delete id="delete${subClassName}By${subTableFkClassName}s" parameterType="String"> | |||
delete from ${subTableName} where ${subTableFkName} in | |||
<foreach item="${subTableFkclassName}" collection="array" open="(" separator="," close=")"> | |||
@@ -121,10 +168,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</foreach> | |||
</delete> | |||
<!--按主表主键删除子表--> | |||
<delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}"> | |||
delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}} | |||
</delete> | |||
<!--子表语法 (要求主表、子表关联主键字段名称相同)--> | |||
<!--批量新增子表--> | |||
<insert id="batch${subClassName}"> | |||
insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values | |||
<foreach item="item" index="index" collection="list" separator=","> | |||
@@ -132,4 +182,108 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</foreach> | |||
</insert> | |||
#end | |||
<!-- Harm --> | |||
<!--单条条件查询--> | |||
<select id="select${ClassName}" parameterType="${ClassName}" resultMap="${ClassName}Result"> | |||
<include refid="select${ClassName}Vo"/> | |||
<where> | |||
#foreach($column in $columns) | |||
#set($queryType=$column.queryType) | |||
#set($javaField=$column.javaField) | |||
#set($javaType=$column.javaType) | |||
#set($columnName=$column.columnName) | |||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | |||
#if($column.query) | |||
#if($column.queryType == "EQ") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if> | |||
#elseif($queryType == "NE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if> | |||
#elseif($queryType == "GT") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName > #{$javaField}</if> | |||
#elseif($queryType == "GTE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName >= #{$javaField}</if> | |||
#elseif($queryType == "LT") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName < #{$javaField}</if> | |||
#elseif($queryType == "LTE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if> | |||
#elseif($queryType == "LIKE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if> | |||
#elseif($queryType == "BETWEEN") | |||
<if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if> | |||
#end | |||
#end | |||
#end | |||
</where> | |||
limit 1 | |||
</select> | |||
<!--条件查询数量--> | |||
<select id="select${ClassName}Count" parameterType="${ClassName}" resultType="Long"> | |||
select count(*) from ${tableName} | |||
<where> | |||
#foreach($column in $columns) | |||
#set($queryType=$column.queryType) | |||
#set($javaField=$column.javaField) | |||
#set($javaType=$column.javaType) | |||
#set($columnName=$column.columnName) | |||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | |||
#if($column.query) | |||
#if($column.queryType == "EQ") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if> | |||
#elseif($queryType == "NE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if> | |||
#elseif($queryType == "GT") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName > #{$javaField}</if> | |||
#elseif($queryType == "GTE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName >= #{$javaField}</if> | |||
#elseif($queryType == "LT") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName < #{$javaField}</if> | |||
#elseif($queryType == "LTE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if> | |||
#elseif($queryType == "LIKE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if> | |||
#elseif($queryType == "BETWEEN") | |||
<if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if> | |||
#end | |||
#end | |||
#end | |||
</where> | |||
</select> | |||
<!--条件查询是否存在--> | |||
<select id="select${ClassName}Exists" parameterType="${ClassName}" resultType="int"> | |||
select exists ( | |||
select 1 from ${tableName} | |||
<where> | |||
#foreach($column in $columns) | |||
#set($queryType=$column.queryType) | |||
#set($javaField=$column.javaField) | |||
#set($javaType=$column.javaType) | |||
#set($columnName=$column.columnName) | |||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | |||
#if($column.query) | |||
#if($column.queryType == "EQ") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if> | |||
#elseif($queryType == "NE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if> | |||
#elseif($queryType == "GT") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName > #{$javaField}</if> | |||
#elseif($queryType == "GTE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName >= #{$javaField}</if> | |||
#elseif($queryType == "LT") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName < #{$javaField}</if> | |||
#elseif($queryType == "LTE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if> | |||
#elseif($queryType == "LIKE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if> | |||
#elseif($queryType == "BETWEEN") | |||
<if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if> | |||
#end | |||
#end | |||
#end | |||
</where> | |||
limit 1 | |||
) | |||
</select> | |||
</mapper> |