Ruoyi若依框架中工单管理(智能售货机运营管理系统)
新建TaskVo
@Data
public class TaskVo extends Task {
// 工单类型
private TaskType taskType;
}
<resultMap type="taskVo" id="TaskVoResult">
<result property="taskId" column="task_id"/>
<result property="taskCode" column="task_code"/>
<result property="taskStatus" column="task_status"/>
<result property="createType" column="create_type"/>
<result property="innerCode" column="inner_code"/>
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
<result property="regionId" column="region_id"/>
<result property="desc" column="desc"/>
<result property="productTypeId" column="product_type_id"/>
<result property="assignorId" column="assignor_id"/>
<result property="addr" column="addr"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<association property="taskType" javaType="TaskType" column="product_type_id"
select="com.dkd.manage.mapper.TaskTypeMapper.selectTaskTypeByTypeId"/>
</resultMap>
<select id="selectTaskVoList" resultMap="TaskVoResult">
<include refid="selectTaskVo"/>
<where>
<if test="taskCode != null and taskCode != ''">and task_code = #{taskCode}</if>
<if test="taskStatus != null ">and task_status = #{taskStatus}</if>
<if test="createType != null ">and create_type = #{createType}</if>
<if test="innerCode != null and innerCode != ''">and inner_code = #{innerCode}</if>
<if test="userId != null ">and user_id = #{userId}</if>
<if test="userName != null and userName != ''">and user_name like concat('%', #{userName}, '%')</if>
<if test="regionId != null ">and region_id = #{regionId}</if>
<if test="desc != null and desc != ''">and `desc` = #{desc}</if>
<if test="productTypeId != null ">and product_type_id = #{productTypeId}</if>
<if test="assignorId != null ">and assignor_id = #{assignorId}</if>
<if test="addr != null and addr != ''">and addr = #{addr}</if>
<if test="params.isRepair != null and params.isRepair=='true'">
and product_type_id in (1,3,4)
</if>
<if test="params.isRepair != null and params.isRepair=='false'">
and product_type_id =2
</if>
order by create_time desc
</where>
</select>
获取运营人员列表
EmpController
@Autowired
private IVendingMachineService vendingMachineService;
/**
* 根据售货机获取运营人员列表
*/
@PreAuthorize("@ss.hasPermi('manage:emp:list')")
@GetMapping("/businessList/{innerCode}")
public AjaxResult businessList(@PathVariable("innerCode") String innerCode) {
// 1.查询售货机信息
VendingMachine vm = vendingMachineService.selectVendingMachineByInnerCode(innerCode);
if (vm == null) {
return error();
}
// 2.根据区域id、角色编号、员工状态查询运营人员列表
Emp empParam = new Emp();
empParam.setRegionId(vm.getRegionId());// 设备所属区域
empParam.setStatus(DkdContants.EMP_STATUS_NORMAL);// 员工启用
empParam.setRoleCode(DkdContants.ROLE_CODE_BUSINESS);// 角色编码:运营员
return success(empService.selectEmpList(empParam));
}
获取运维人员列表
/*
根据售货机获取运维人员列表
*/
@GetMapping("/operationList/{innerCode}")
public AjaxResult operationList(@PathVariable("innerCode") String innerCode) {
// 1.查询售货机信息
VendingMachine vendingMachine = vendingMachineService.selectVendingMachineByInnerCode(innerCode);
if (vendingMachine == null) {
return error("售货机不存在");
}
// 2.根据区域id、角色编号、员工状态查询运维人员列表
Emp empParam = new Emp();
empParam.setRegionId(vendingMachine.getRegionId());// 设备所属区域
empParam.setStatus(Math.toIntExact(DkdContants.EMP_STATUS_NORMAL));// 员工启用
empParam.setRoleCode(DkdContants.ROLE_CODE_OPERATOR);// 角色编码:运维员
return success(empService.selectEmpList(empParam));
}