添加指令包功能
This commit is contained in:
parent
061cfb04c1
commit
8b720684f6
|
@ -0,0 +1,179 @@
|
||||||
|
package com.nu.modules.directivepackage.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.nu.modules.directivepackage.entity.DirectivePackage;
|
||||||
|
import com.nu.modules.directivepackage.service.IDirectivePackageService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 服务指令包
|
||||||
|
* @Author: 张明远
|
||||||
|
* @Date: 2025-03-24
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Api(tags = "服务指令包")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/services/directivePackage/directivePackage")
|
||||||
|
@Slf4j
|
||||||
|
public class DirectivePackageController extends JeecgController<DirectivePackage, IDirectivePackageService> {
|
||||||
|
@Autowired
|
||||||
|
private IDirectivePackageService directivePackageService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页列表查询
|
||||||
|
*
|
||||||
|
* @param directivePackage
|
||||||
|
* @param pageNo
|
||||||
|
* @param pageSize
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "服务指令包-分页列表查询")
|
||||||
|
@ApiOperation(value = "服务指令包-分页列表查询", notes = "服务指令包-分页列表查询")
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<DirectivePackage>> queryPageList(DirectivePackage directivePackage,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||||
|
// 自定义多选的查询规则为:LIKE_WITH_OR
|
||||||
|
customeRuleMap.put("packageName", QueryRuleEnum.LIKE_WITH_OR);
|
||||||
|
QueryWrapper<DirectivePackage> queryWrapper = QueryGenerator.initQueryWrapper(directivePackage, req.getParameterMap(),customeRuleMap);
|
||||||
|
Page<DirectivePackage> page = new Page<DirectivePackage>(pageNo, pageSize);
|
||||||
|
queryWrapper.select("id");
|
||||||
|
queryWrapper.orderByDesc("create_time");
|
||||||
|
IPage<DirectivePackage> pageList = directivePackageService.page(page, queryWrapper);
|
||||||
|
if (pageList.getRecords() != null && !pageList.getRecords().isEmpty()) {
|
||||||
|
directivePackageService.queryList(directivePackage, pageList);
|
||||||
|
}
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*
|
||||||
|
* @param directivePackage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "服务指令包-添加")
|
||||||
|
@ApiOperation(value = "服务指令包-添加", notes = "服务指令包-添加")
|
||||||
|
@RequiresPermissions("directivePackage:directive_package:add")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<String> add(@RequestBody DirectivePackage directivePackage) {
|
||||||
|
directivePackageService.save(directivePackage);
|
||||||
|
if (directivePackage.getDirectives() != null && !directivePackage.getDirectives().isEmpty()) {
|
||||||
|
directivePackageService.saveDirectives(directivePackage);
|
||||||
|
}
|
||||||
|
return Result.OK("添加成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @param directivePackage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "服务指令包-编辑")
|
||||||
|
@ApiOperation(value = "服务指令包-编辑", notes = "服务指令包-编辑")
|
||||||
|
@RequiresPermissions("directivePackage:directive_package:edit")
|
||||||
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
public Result<String> edit(@RequestBody DirectivePackage directivePackage) {
|
||||||
|
directivePackageService.updateById(directivePackage);
|
||||||
|
if (directivePackage.getDirectives() != null && !directivePackage.getDirectives().isEmpty()) {
|
||||||
|
directivePackageService.saveDirectives(directivePackage);
|
||||||
|
}
|
||||||
|
return Result.OK("编辑成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "服务指令包-通过id删除")
|
||||||
|
@ApiOperation(value = "服务指令包-通过id删除", notes = "服务指令包-通过id删除")
|
||||||
|
@RequiresPermissions("directivePackage:directive_package:delete")
|
||||||
|
@DeleteMapping(value = "/delete")
|
||||||
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
directivePackageService.removeById(id);
|
||||||
|
return Result.OK("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "服务指令包-批量删除")
|
||||||
|
@ApiOperation(value = "服务指令包-批量删除", notes = "服务指令包-批量删除")
|
||||||
|
@RequiresPermissions("directivePackage:directive_package:deleteBatch")
|
||||||
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||||
|
this.directivePackageService.removeByIds(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("批量删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "服务指令包-通过id查询")
|
||||||
|
@ApiOperation(value = "服务指令包-通过id查询", notes = "服务指令包-通过id查询")
|
||||||
|
@GetMapping(value = "/queryById")
|
||||||
|
public Result<DirectivePackage> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
DirectivePackage directivePackage = directivePackageService.queryById(id);
|
||||||
|
if (directivePackage == null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(directivePackage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出excel
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param directivePackage
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("directivePackage:directive_package:exportXls")
|
||||||
|
@RequestMapping(value = "/exportXls")
|
||||||
|
public ModelAndView exportXls(HttpServletRequest request, DirectivePackage directivePackage) {
|
||||||
|
return super.exportXls(request, directivePackage, DirectivePackage.class, "服务指令包");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过excel导入数据
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("directivePackage:directive_package:importExcel")
|
||||||
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
return super.importExcel(request, response, DirectivePackage.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package com.nu.modules.directivepackage.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||||
|
import lombok.Data;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.jeecg.common.aspect.annotation.Dict;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 服务指令包
|
||||||
|
* @Author: 张明远
|
||||||
|
* @Date: 2025-03-24
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("nu_directive_package")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value="nu_directive_package对象", description="服务指令包")
|
||||||
|
public class DirectivePackage implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**id*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private java.lang.String id;
|
||||||
|
/**服务指令包名称*/
|
||||||
|
@Excel(name = "服务指令包名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "服务指令包名称")
|
||||||
|
private java.lang.String packageName;
|
||||||
|
@Excel(name = "服务总时长", width = 15)
|
||||||
|
@ApiModelProperty(value = "服务总时长")
|
||||||
|
private Long totalDuration;
|
||||||
|
/**备注*/
|
||||||
|
@Excel(name = "备注", width = 15)
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private java.lang.String description;
|
||||||
|
/**排序*/
|
||||||
|
@Excel(name = "排序", width = 15)
|
||||||
|
@ApiModelProperty(value = "排序")
|
||||||
|
private java.lang.Integer sort;
|
||||||
|
/**是否启用 0启用 1未启用*/
|
||||||
|
@Excel(name = "是否启用", width = 15, dicCode = "iz_enabled")
|
||||||
|
@Dict(dicCode = "iz_enabled")
|
||||||
|
@ApiModelProperty(value = "是否启用")
|
||||||
|
private java.lang.String izEnabled;
|
||||||
|
/**是否删除 0未删除 1删除*/
|
||||||
|
@Excel(name = "是否删除", width = 15)
|
||||||
|
@ApiModelProperty(value = "是否删除")
|
||||||
|
@TableLogic
|
||||||
|
private java.lang.String delFlag;
|
||||||
|
/**创建人*/
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
@Dict(dictTable = "sys_user",dicCode = "username",dicText = "realname")
|
||||||
|
private java.lang.String createBy;
|
||||||
|
/**创建日期*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "创建日期")
|
||||||
|
private java.util.Date createTime;
|
||||||
|
/**更新人*/
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private java.lang.String updateBy;
|
||||||
|
/**更新日期*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "更新日期")
|
||||||
|
private java.util.Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开始时间")
|
||||||
|
private java.lang.String startTimeStr;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "结束时间")
|
||||||
|
private java.lang.String endTimeStr;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "分类标签")
|
||||||
|
private java.lang.String instructionTagId;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<ConfigServiceDirective> directives;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.nu.modules.directivepackage.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.nu.modules.directivepackage.entity.DirectivePackage;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 服务指令包
|
||||||
|
* @Author: 张明远
|
||||||
|
* @Date: 2025-03-24
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface DirectivePackageMapper extends BaseMapper<DirectivePackage> {
|
||||||
|
|
||||||
|
int deleteDirectives(@Param("package") DirectivePackage directivePackage);
|
||||||
|
|
||||||
|
int saveDirectives(@Param("package") DirectivePackage directivePackage);
|
||||||
|
|
||||||
|
int updateTotalDurationInt(@Param("id") String id,@Param("duration") Long duration);
|
||||||
|
|
||||||
|
List<DirectivePackage> queryList( @Param("directivePackage") DirectivePackage directivePackage,@Param("ids") List<DirectivePackage> ids);
|
||||||
|
|
||||||
|
Long queryTotal(@Param("directivePackage") DirectivePackage directivePackage);
|
||||||
|
}
|
|
@ -0,0 +1,190 @@
|
||||||
|
<?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.nu.modules.directivepackage.mapper.DirectivePackageMapper">
|
||||||
|
|
||||||
|
<!-- 定义 resultMap -->
|
||||||
|
<resultMap id="DirectivePackageResultMap" type="com.nu.modules.directivepackage.entity.DirectivePackage">
|
||||||
|
<id property="id" column="id" />
|
||||||
|
<result property="packageName" column="package_name" />
|
||||||
|
<result property="description" column="description" />
|
||||||
|
<result property="sort" column="sort" />
|
||||||
|
<result property="izEnabled" column="iz_enabled" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="startTimeStr" column="start_time_str" />
|
||||||
|
<result property="endTimeStr" column="end_time_str" />
|
||||||
|
<result property="instructionTagId" column="instruction_tag_id" />
|
||||||
|
<!-- 关联的指令列表 -->
|
||||||
|
<collection property="directives" ofType="com.nu.modules.servicedirective.entity.ConfigServiceDirective">
|
||||||
|
<id property="id" column="directive_id" />
|
||||||
|
<result property="directiveName" column="directive_name" />
|
||||||
|
<result property="categoryId" column="category_id" />
|
||||||
|
<result property="typeId" column="type_id" />
|
||||||
|
<result property="instructionTagId" column="instruction_tag_id" />
|
||||||
|
<result property="instructionTagName" column="instruction_name" />
|
||||||
|
<result property="tollPrice" column="toll_price" />
|
||||||
|
<result property="comPrice" column="com_price" />
|
||||||
|
<result property="izReimbursement" column="iz_reimbursement" />
|
||||||
|
<result property="izPreferential" column="iz_preferential" />
|
||||||
|
<result property="chargingFrequency" column="charging_frequency" />
|
||||||
|
<result property="cycleType" column="cycle_type" />
|
||||||
|
<result property="serviceContent" column="service_content" />
|
||||||
|
<result property="serviceDuration" column="service_duration" />
|
||||||
|
<result property="izEnabled" column="directive_iz_enabled" />
|
||||||
|
<result property="delFlag" column="directive_del_flag" />
|
||||||
|
<result property="createBy" column="directive_create_by" />
|
||||||
|
<result property="createTime" column="directive_create_time" />
|
||||||
|
<result property="updateBy" column="directive_update_by" />
|
||||||
|
<result property="updateTime" column="directive_update_time" />
|
||||||
|
<result property="sysOrgCode" column="directive_sys_org_code" />
|
||||||
|
<result property="mp3File" column="mp3_file" />
|
||||||
|
<result property="mp4File" column="mp4_file" />
|
||||||
|
<result property="categoryName" column="csc_category_name" />
|
||||||
|
<result property="typeName" column="cst_type_name" />
|
||||||
|
<result property="previewFile" column="preview_file"/>
|
||||||
|
<result property="immediateFile" column="immediate_file"/>
|
||||||
|
<!-- 关联的体型标签列表 -->
|
||||||
|
<collection property="bodyTagList" ofType="com.nu.modules.directivetag.body.entity.DirectiveBodyTag">
|
||||||
|
<id property="id" column="tag_id" />
|
||||||
|
<result property="tagName" column="bodytag_name" />
|
||||||
|
<result property="sort" column="bodytag_sort" />
|
||||||
|
<result property="izEnabled" column="bodytag_iz_enabled" />
|
||||||
|
<result property="delFlag" column="bodytag_del_flag" />
|
||||||
|
<result property="createBy" column="bodytag_create_by" />
|
||||||
|
<result property="createTime" column="bodytag_create_time" />
|
||||||
|
<result property="updateBy" column="bodytag_update_by" />
|
||||||
|
<result property="updateTime" column="bodytag_update_time" />
|
||||||
|
<result property="sysOrgCode" column="bodytag_sys_org_code" />
|
||||||
|
</collection>
|
||||||
|
<!-- 关联的情绪标签列表 -->
|
||||||
|
<collection property="emotionTagList" ofType="com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag">
|
||||||
|
<id property="id" column="emotag_id" />
|
||||||
|
<result property="tagName" column="emotag_name" />
|
||||||
|
<result property="sort" column="emotag_sort" />
|
||||||
|
<result property="izEnabled" column="emotag_iz_enabled" />
|
||||||
|
<result property="delFlag" column="emotag_del_flag" />
|
||||||
|
<result property="createBy" column="emotag_create_by" />
|
||||||
|
<result property="createTime" column="emotag_create_time" />
|
||||||
|
<result property="updateBy" column="emotag_update_by" />
|
||||||
|
<result property="updateTime" column="emotag_update_time" />
|
||||||
|
<result property="sysOrgCode" column="emotag_sys_org_code" />
|
||||||
|
</collection>
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
<update id="updateTotalDurationInt">
|
||||||
|
update nu_directive_package set total_duration = #{duration} where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="queryList" resultMap="DirectivePackageResultMap">
|
||||||
|
SELECT
|
||||||
|
dp.id,
|
||||||
|
dp.package_name,
|
||||||
|
dp.description,
|
||||||
|
dp.sort,
|
||||||
|
dp.iz_enabled,
|
||||||
|
dp.del_flag,
|
||||||
|
dp.create_by,
|
||||||
|
dp.create_time,
|
||||||
|
dp.update_by,
|
||||||
|
dp.update_time,
|
||||||
|
dp.start_time_str,
|
||||||
|
dp.end_time_str,
|
||||||
|
dp.instruction_tag_id,
|
||||||
|
csd.id AS directive_id,
|
||||||
|
csd.directive_name,
|
||||||
|
csd.category_id,
|
||||||
|
csd.type_id,
|
||||||
|
csd.instruction_tag_id,
|
||||||
|
csd.toll_price,
|
||||||
|
csd.com_price,
|
||||||
|
csd.iz_reimbursement,
|
||||||
|
csd.iz_preferential,
|
||||||
|
csd.charging_frequency,
|
||||||
|
csd.cycle_type,
|
||||||
|
csd.service_content,
|
||||||
|
csd.service_duration,
|
||||||
|
csd.iz_enabled AS directive_iz_enabled,
|
||||||
|
csd.del_flag AS directive_del_flag,
|
||||||
|
csd.create_by AS directive_create_by,
|
||||||
|
csd.create_time AS directive_create_time,
|
||||||
|
csd.update_by AS directive_update_by,
|
||||||
|
csd.update_time AS directive_update_time,
|
||||||
|
csd.sys_org_code AS directive_sys_org_code,
|
||||||
|
csd.mp3_file,
|
||||||
|
csd.mp4_file,
|
||||||
|
csd.preview_file,
|
||||||
|
csd.immediate_file,
|
||||||
|
cdbt.id AS bodytag_id,
|
||||||
|
cdbt.tag_name AS bodytag_name,
|
||||||
|
cdbt.sort AS bodytag_sort,
|
||||||
|
cdbt.iz_enabled AS bodytag_iz_enabled,
|
||||||
|
cdbt.del_flag AS bodytag_del_flag,
|
||||||
|
cdbt.create_by AS bodytag_create_by,
|
||||||
|
cdbt.create_time AS bodytag_create_time,
|
||||||
|
cdbt.update_by AS bodytag_update_by,
|
||||||
|
cdbt.update_time AS bodytag_update_time,
|
||||||
|
cdbt.sys_org_code AS bodytag_sys_org_code,
|
||||||
|
cdet.id AS emotag_id,
|
||||||
|
cdet.tag_name AS emotag_name,
|
||||||
|
cdet.sort AS emotag_sort,
|
||||||
|
cdet.iz_enabled AS emotag_iz_enabled,
|
||||||
|
cdet.del_flag AS emotag_del_flag,
|
||||||
|
cdet.create_by AS emotag_create_by,
|
||||||
|
cdet.create_time AS emotag_create_time,
|
||||||
|
cdet.update_by AS emotag_update_by,
|
||||||
|
cdet.update_time AS emotag_update_time,
|
||||||
|
cdet.sys_org_code AS emotag_sys_org_code,
|
||||||
|
csc.category_name AS csc_category_name,
|
||||||
|
cst.type_name AS cst_type_name,
|
||||||
|
insTag.instruction_name AS instruction_name
|
||||||
|
FROM
|
||||||
|
(SELECT * FROM nu_directive_package
|
||||||
|
<where>
|
||||||
|
del_flag = '0' and id in
|
||||||
|
<foreach collection="ids" item="item" open="(" separator="," close=")">
|
||||||
|
#{item.id}
|
||||||
|
</foreach>
|
||||||
|
</where>) dp
|
||||||
|
LEFT JOIN nu_package_directive pd ON dp.id = pd.package_id
|
||||||
|
LEFT JOIN nu_config_service_directive csd ON pd.directive_id = csd.id
|
||||||
|
LEFT JOIN nu_directive_body_tag bdt ON csd.id = bdt.directive_id
|
||||||
|
LEFT JOIN nu_config_body_tag cdbt ON bdt.tag_id = cdbt.id
|
||||||
|
LEFT JOIN nu_directive_emotion_tag edt ON csd.id = edt.directive_id
|
||||||
|
LEFT JOIN nu_config_emotion_tag cdet ON edt.tag_id = cdet.id
|
||||||
|
LEFT JOIN nu_config_service_category csc ON csd.category_id = csc.id
|
||||||
|
LEFT JOIN nu_config_service_type cst ON csd.type_id = cst.id
|
||||||
|
left join nu_config_service_instruction_tag insTag on csd.instruction_tag_id = insTag.id
|
||||||
|
order by dp.create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询总记录数 -->
|
||||||
|
<select id="queryTotal" resultType="java.lang.Long">
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM nu_directive_package
|
||||||
|
<where>
|
||||||
|
del_flag = '0'
|
||||||
|
<if test="directivePackage.packageName != null and directivePackage.packageName != ''">
|
||||||
|
AND package_name LIKE CONCAT('%', #{directivePackage.packageName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="directivePackage.izEnabled != null and directivePackage.izEnabled != ''">
|
||||||
|
AND iz_enabled = #{directivePackage.izEnabled}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteDirectives">
|
||||||
|
delete from nu_package_directive where package_id = #{package.id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="saveDirectives">
|
||||||
|
INSERT INTO nu_package_directive (package_id, directive_id, sort)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="package.getDirectives()" item="directive" separator=",">
|
||||||
|
(#{package.id}, #{directive.id}, #{directive.sort})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.nu.modules.directivepackage.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.nu.modules.directivepackage.entity.DirectivePackage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 服务指令包
|
||||||
|
* @Author: 张明远
|
||||||
|
* @Date: 2025-03-24
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface IDirectivePackageService extends IService<DirectivePackage> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储服务指令包对应的服务指令
|
||||||
|
* @param directivePackage
|
||||||
|
*/
|
||||||
|
void saveDirectives(DirectivePackage directivePackage);
|
||||||
|
|
||||||
|
void queryList(DirectivePackage directivePackage, IPage<DirectivePackage> pageList);
|
||||||
|
|
||||||
|
DirectivePackage queryById(String id);
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.nu.modules.directivepackage.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.nu.modules.directivepackage.entity.DirectivePackage;
|
||||||
|
import com.nu.modules.directivepackage.mapper.DirectivePackageMapper;
|
||||||
|
import com.nu.modules.directivepackage.service.IDirectivePackageService;
|
||||||
|
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 服务指令包
|
||||||
|
* @Author: 张明远
|
||||||
|
* @Date: 2025-03-24
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DirectivePackageServiceImpl extends ServiceImpl<DirectivePackageMapper, DirectivePackage> implements IDirectivePackageService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveDirectives(DirectivePackage directivePackage) {
|
||||||
|
baseMapper.deleteDirectives(directivePackage);
|
||||||
|
baseMapper.saveDirectives(directivePackage);
|
||||||
|
//计算总时长
|
||||||
|
Long duration = 0l;
|
||||||
|
for (ConfigServiceDirective directive : directivePackage.getDirectives()) {
|
||||||
|
if(StringUtils.isNotBlank(directive.getServiceDuration())){
|
||||||
|
duration += Long.parseLong(directive.getServiceDuration());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
baseMapper.updateTotalDurationInt(directivePackage.getId(),duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void queryList(DirectivePackage directivePackage, IPage<DirectivePackage> pageList) {
|
||||||
|
List<DirectivePackage> record = baseMapper.queryList(directivePackage,pageList.getRecords());
|
||||||
|
pageList.setRecords(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DirectivePackage queryById(String id) {
|
||||||
|
List<DirectivePackage> query = Lists.newArrayList();
|
||||||
|
DirectivePackage queryDto = new DirectivePackage().setId(id);
|
||||||
|
query.add(queryDto);
|
||||||
|
List<DirectivePackage> directivePackages = baseMapper.queryList(null, query);
|
||||||
|
return directivePackages.stream().findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -199,4 +199,7 @@ public class ConfigServiceDirective implements Serializable {
|
||||||
//媒体资源存储路径名
|
//媒体资源存储路径名
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String mediaFileSavePath;
|
private String mediaFileSavePath;
|
||||||
|
//护理分类名称
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String instructionTagName;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue