diff --git a/pom.xml b/pom.xml index 89ddaf1..959b969 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,9 @@ 4.1.2 2.3 0.9.1 + + 1.16.18 + 5.5.4 @@ -170,6 +173,27 @@ ${ruoyi.version} + + + org.projectlombok + lombok + ${lombok.version} + + + + + cn.hutool + hutool-all + ${hutool.version} + + + + + com.ruoyi + ruoyi-agentcenter + ${ruoyi.version} + + @@ -180,12 +204,20 @@ ruoyi-quartz ruoyi-generator ruoyi-common + ruoyi-agentcenter pom - + + org.projectlombok + lombok + + + cn.hutool + hutool-all + diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 5bfa504..c7f2137 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -61,6 +61,12 @@ ruoyi-generator + + + com.ruoyi + ruoyi-agentcenter + + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/agentcenter/TAgentTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/agentcenter/TAgentTaskController.java new file mode 100644 index 0000000..0ea4cc9 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/agentcenter/TAgentTaskController.java @@ -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 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 list = tAgentTaskService.selectTAgentTaskList(tAgentTask); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index b34e76d..411383f 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -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: diff --git a/ruoyi-agentcenter/pom.xml b/ruoyi-agentcenter/pom.xml new file mode 100644 index 0000000..c86d850 --- /dev/null +++ b/ruoyi-agentcenter/pom.xml @@ -0,0 +1,28 @@ + + + + ruoyi + com.ruoyi + 3.8.5 + + 4.0.0 + + ruoyi-agentcenter + + + 代理中心 + + + + + + + com.ruoyi + ruoyi-common + + + + + \ No newline at end of file diff --git a/ruoyi-agentcenter/src/main/java/com/ruoyi/agentcenter/domain/TAgentTask.java b/ruoyi-agentcenter/src/main/java/com/ruoyi/agentcenter/domain/TAgentTask.java new file mode 100644 index 0000000..302bfed --- /dev/null +++ b/ruoyi-agentcenter/src/main/java/com/ruoyi/agentcenter/domain/TAgentTask.java @@ -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; + +} diff --git a/ruoyi-agentcenter/src/main/java/com/ruoyi/agentcenter/mapper/TAgentTaskMapper.java b/ruoyi-agentcenter/src/main/java/com/ruoyi/agentcenter/mapper/TAgentTaskMapper.java new file mode 100644 index 0000000..15361a6 --- /dev/null +++ b/ruoyi-agentcenter/src/main/java/com/ruoyi/agentcenter/mapper/TAgentTaskMapper.java @@ -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 selectTAgentTaskList(TAgentTask tAgentTask); + + /** + * 新增任务清单 + * + * @param tAgentTask 任务清单 + * @return 结果 + */ + public int insertTAgentTask(TAgentTask tAgentTask); + + /** + * 批量新增任务清单 + * + * @param list 任务清单 + * @return 结果 + */ + public int insertTAgentTaskBatch(List list); + + /** + * 批量修改 任务清单 + * + * @param list 任务清单 + * @return 结果 + */ + public int updateTAgentTaskBatch(List 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); +} diff --git a/ruoyi-agentcenter/src/main/java/com/ruoyi/agentcenter/service/ITAgentTaskService.java b/ruoyi-agentcenter/src/main/java/com/ruoyi/agentcenter/service/ITAgentTaskService.java new file mode 100644 index 0000000..b7d6938 --- /dev/null +++ b/ruoyi-agentcenter/src/main/java/com/ruoyi/agentcenter/service/ITAgentTaskService.java @@ -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 selectTAgentTaskList(TAgentTask tAgentTask); + + /** + * 新增任务清单 + * + * @param tAgentTask 任务清单 + * @return 结果 + */ + public int insertTAgentTask(TAgentTask tAgentTask); + + /** + * 批量新增任务清单 + * + * @param list 任务清单 + * @return 结果 + */ + public int insertTAgentTaskBatch(List list); + + /** + * 修改任务清单 + * + * @param tAgentTask 任务清单 + * @return 结果 + */ + public int updateTAgentTask(TAgentTask tAgentTask); + + /** + * 批量修改 任务清单 + * + * @param list 任务清单 + * @return 结果 + */ + public int updateTAgentTaskBatch(List 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); +} diff --git a/ruoyi-agentcenter/src/main/java/com/ruoyi/agentcenter/service/impl/TAgentTaskServiceImpl.java b/ruoyi-agentcenter/src/main/java/com/ruoyi/agentcenter/service/impl/TAgentTaskServiceImpl.java new file mode 100644 index 0000000..87eaf0e --- /dev/null +++ b/ruoyi-agentcenter/src/main/java/com/ruoyi/agentcenter/service/impl/TAgentTaskServiceImpl.java @@ -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 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 list){ + List> 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 list) { + List> 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; + } +} diff --git a/ruoyi-agentcenter/src/main/resources/mapper/agentcenter/TAgentTaskMapper.xml b/ruoyi-agentcenter/src/main/resources/mapper/agentcenter/TAgentTaskMapper.xml new file mode 100644 index 0000000..7758197 --- /dev/null +++ b/ruoyi-agentcenter/src/main/resources/mapper/agentcenter/TAgentTaskMapper.xml @@ -0,0 +1,399 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + + insert into t_agent_task + + 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, + + + #{agentCenter}, + #{countyCode}, + #{countyName}, + #{townCode}, + #{townName}, + #{orgCode}, + #{orgName}, + #{bookCount}, + #{voucherCount}, + #{contractionCount}, + #{assetCount}, + #{allCount}, + #{orderYear}, + #{orderMonth}, + #{agentStatus}, + #{distributionChief}, + #{distributionDate}, + #{endAt}, + #{handleAccount}, + #{handleDate}, + #{auditAccount}, + #{auditDate}, + #{taskScore}, + #{taskAppraise}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + + insert into t_agent_task + + 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, + + values + + + #{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}, + + + + + + + update t_agent_task + + agent_center = #{agentCenter}, + county_code = #{countyCode}, + county_name = #{countyName}, + town_code = #{townCode}, + town_name = #{townName}, + org_code = #{orgCode}, + org_name = #{orgName}, + book_count = #{bookCount}, + voucher_count = #{voucherCount}, + contraction_count = #{contractionCount}, + asset_count = #{assetCount}, + all_count = #{allCount}, + order_year = #{orderYear}, + order_month = #{orderMonth}, + agent_status = #{agentStatus}, + distribution_chief = #{distributionChief}, + distribution_date = #{distributionDate}, + end_at = #{endAt}, + handle_account = #{handleAccount}, + handle_date = #{handleDate}, + audit_account = #{auditAccount}, + audit_date = #{auditDate}, + task_score = #{taskScore}, + task_appraise = #{taskAppraise}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + `${col}` = #{val}, + + where id = #{id} + + + + + + update t_agent_task + + agent_center = #{item.agentCenter}, + county_code = #{item.countyCode}, + county_name = #{item.countyName}, + town_code = #{item.townCode}, + town_name = #{item.townName}, + org_code = #{item.orgCode}, + org_name = #{item.orgName}, + book_count = #{item.bookCount}, + voucher_count = #{item.voucherCount}, + contraction_count = #{item.contractionCount}, + asset_count = #{item.assetCount}, + all_count = #{item.allCount}, + order_year = #{item.orderYear}, + order_month = #{item.orderMonth}, + agent_status = #{item.agentStatus}, + distribution_chief = #{item.distributionChief}, + distribution_date = #{item.distributionDate}, + end_at = #{item.endAt}, + handle_account = #{item.handleAccount}, + handle_date = #{item.handleDate}, + audit_account = #{item.auditAccount}, + audit_date = #{item.auditDate}, + task_score = #{item.taskScore}, + task_appraise = #{item.taskAppraise}, + create_by = #{item.createBy}, + create_time = #{item.createTime}, + update_by = #{item.updateBy}, + update_time = #{item.updateTime}, + `${col}` = #{val}, + + where id = #{item.id} + + + + + + delete from t_agent_task where id = #{id} + + + + + delete from t_agent_task where id in + + #{id} + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java index a685e06..92a4b8c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java @@ -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(); + } } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java index 2aed686..94b63fb 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -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()); diff --git a/ruoyi-generator/src/main/resources/generator.yml b/ruoyi-generator/src/main/resources/generator.yml index 5bd3dd6..3a2e7f1 100644 --- a/ruoyi-generator/src/main/resources/generator.yml +++ b/ruoyi-generator/src/main/resources/generator.yml @@ -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_ \ No newline at end of file + tablePrefix: t_ \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm index bf88988..7274018 100644 --- a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm @@ -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})); } } diff --git a/ruoyi-generator/src/main/resources/vm/java/domain.java.vm b/ruoyi-generator/src/main/resources/vm/java/domain.java.vm index bd51c17..ce4e055 100644 --- a/ruoyi-generator/src/main/resources/vm/java/domain.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/domain.java.vm @@ -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(); - } } diff --git a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm index 7e7d7c2..ed144a7 100644 --- a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm @@ -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}); } diff --git a/ruoyi-generator/src/main/resources/vm/java/service.java.vm b/ruoyi-generator/src/main/resources/vm/java/service.java.vm index 264882b..f2063d6 100644 --- a/ruoyi-generator/src/main/resources/vm/java/service.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/service.java.vm @@ -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}); } diff --git a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm index 14746e1..026aa1f 100644 --- a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm @@ -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> 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> 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; + } } diff --git a/ruoyi-generator/src/main/resources/vm/js/api.js.vm b/ruoyi-generator/src/main/resources/vm/js/api.js.vm index 9295524..4e876b4 100644 --- a/ruoyi-generator/src/main/resources/vm/js/api.js.vm +++ b/ruoyi-generator/src/main/resources/vm/js/api.js.vm @@ -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({ diff --git a/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm b/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm index 0ceb3d8..d3a6613 100644 --- a/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm +++ b/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm @@ -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} + + + insert into ${tableName} @@ -90,6 +93,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + insert into ${tableName} + +#foreach($column in $columns) +#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) + $column.columnName, +#end +#end + + values + + +#foreach($column in $columns) +#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) + #{item.$column.javaField}, +#end +#end + + + + + update ${tableName} @@ -98,14 +124,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" $column.columnName = #{$column.javaField}, #end #end + `${col}` = #{val}, where ${pkColumn.columnName} = #{${pkColumn.javaField}} + + + + update ${tableName} + +#foreach($column in $columns) +#if($column.columnName != $pkColumn.columnName) + $column.columnName = #{item.$column.javaField}, +#end +#end + `${col}` = #{val}, + + where ${pkColumn.columnName} = #{item.${pkColumn.javaField}} + + + + delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}} + delete from ${tableName} where ${pkColumn.columnName} in @@ -114,6 +159,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #if($table.sub) + + delete from ${subTableName} where ${subTableFkName} in @@ -121,10 +168,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}} - + + + insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values @@ -132,4 +182,108 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #end + + + + + + + + + + \ No newline at end of file