巡检计划修改初始化

highway
wws 1 year ago
parent 435e7adcd4
commit 6bde4f4df9

@ -31,11 +31,30 @@ import com.op.common.core.web.page.TableDataInfo;
* @date 2023-10-16
*/
@RestController
@RequestMapping("/plan")
@RequestMapping("/inspectionPlan")
public class EquPlanController extends BaseController {
@Autowired
private IEquPlanService equPlanService;
/**
*
* @param equPlan
* @return
*/
@PostMapping("/initUpdatePlanInfo")
public AjaxResult initUpdatePlanInfo(@RequestBody EquPlan equPlan) {
return equPlanService.initUpdatePlanInfo(equPlan);
}
/**
*
* @return
*/
@GetMapping("/getWorkCenter")
public AjaxResult getWorkCenter() {
return equPlanService.getWorkCenter();
}
/**
* list
*

@ -135,6 +135,16 @@ public class EquPlan extends BaseEntity {
private List<Date> planTimeArray;
private List<Long> personListVO;
public List<Long> getPersonListVO() {
return personListVO;
}
public void setPersonListVO(List<Long> personListVO) {
this.personListVO = personListVO;
}
public List<Date> getPlanTimeArray() {
return planTimeArray;
}

@ -77,6 +77,17 @@ public class EquPlanDetail extends BaseEntity {
// 关联-检查项->检查详情list
private List<EquPlanStandard> equPlanStandardList;
// 主计划code
private String planCode;
public String getPlanCode() {
return planCode;
}
public void setPlanCode(String planCode) {
this.planCode = planCode;
}
public List<EquPlanStandard> getEquPlanStandardList() {
return equPlanStandardList;
}

@ -61,6 +61,17 @@ public class EquPlanEqu extends BaseEntity {
private String itemTempName;
// 主计划code
private String planCode;
public String getPlanCode() {
return planCode;
}
public void setPlanCode(String planCode) {
this.planCode = planCode;
}
public String getItemTempName() {
return itemTempName;
}

@ -0,0 +1,133 @@
package com.op.device.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
/**
* equ_plan_person
*
* @author Open Platform
* @date 2023-10-19
*/
public class EquPlanPerson extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键 */
private String id;
/** 计划编码 */
@Excel(name = "计划编码")
private String planCode;
/** 用户id */
@Excel(name = "用户id")
private Long userId;
/** 账号 */
@Excel(name = "账号")
private String userName;
/** 工厂 */
@Excel(name = "工厂")
private String factoryCode;
/** 备用字段1 */
@Excel(name = "备用字段1")
private String attr1;
/** 备用字段2 */
@Excel(name = "备用字段2")
private String attr2;
/** 备用字段3 */
@Excel(name = "备用字段3")
private String attr3;
/** 删除标识 */
private String delFlag;
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setPlanCode(String planCode) {
this.planCode = planCode;
}
public String getPlanCode() {
return planCode;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getUserId() {
return userId;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserName() {
return userName;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2() {
return attr2;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public String getAttr3() {
return attr3;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("planCode", getPlanCode())
.append("userId", getUserId())
.append("userName", getUserName())
.append("factoryCode", getFactoryCode())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -69,6 +69,37 @@ public class EquPlanStandard extends BaseEntity {
/** 删除标识 */
private String delFlag;
// 主计划code
private String planCode;
private String itemName;
private String standardTypeName;
public String getStandardTypeName() {
return standardTypeName;
}
public void setStandardTypeName(String standardTypeName) {
this.standardTypeName = standardTypeName;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public String getPlanCode() {
return planCode;
}
public void setPlanCode(String planCode) {
this.planCode = planCode;
}
public void setId(String id) {
this.id = id;
}

@ -0,0 +1,44 @@
package com.op.device.domain;
// 工作中心实体类
public class WorkCenter {
private int factoryId;
private String factoryName;
private String factoryCode;
private String fType;
public int getFactoryId() {
return factoryId;
}
public void setFactoryId(int factoryId) {
this.factoryId = factoryId;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getfType() {
return fType;
}
public void setfType(String fType) {
this.fType = fType;
}
}

@ -58,4 +58,11 @@ public interface EquPlanDetailMapper {
* @return
*/
public int deleteEquPlanDetailByIds(String[] ids);
/**
* code
* @param planCode
* @return
*/
List<EquPlanDetail> selectEquPlanDetailByPlanCode(String planCode);
}

@ -58,4 +58,11 @@ public interface EquPlanEquMapper {
* @return
*/
public int deleteEquPlanEquByIds(String[] ids);
/**
* codelist
* @param planCode
* @return
*/
List<EquPlanEqu> selectEquPlanEquByPlanCode(String planCode);
}

@ -5,6 +5,7 @@ import java.util.List;
import com.op.device.domain.EquCheckItem;
import com.op.device.domain.EquCheckItemDetail;
import com.op.device.domain.EquPlan;
import com.op.device.domain.WorkCenter;
import com.op.device.domain.dto.InspectionPlanDTO;
import com.op.device.domain.vo.InspectionPlanVO;
@ -68,4 +69,18 @@ public interface EquPlanMapper {
* @return
*/
int selectSerialNumber();
/**
* list
* @param factory
* @return
*/
List<WorkCenter> selectWorkCenter(String factory);
/**
*
* @param planCode
* @return
*/
EquPlan selectEquPlanByPlanCode(String planCode);
}

@ -0,0 +1,68 @@
package com.op.device.mapper;
import java.util.List;
import com.op.device.domain.EquPlanPerson;
/**
* Mapper
*
* @author Open Platform
* @date 2023-10-19
*/
public interface EquPlanPersonMapper {
/**
*
*
* @param id
* @return
*/
public EquPlanPerson selectEquPlanPersonById(String id);
/**
*
*
* @param equPlanPerson
* @return
*/
public List<EquPlanPerson> selectEquPlanPersonList(EquPlanPerson equPlanPerson);
/**
*
*
* @param equPlanPerson
* @return
*/
public int insertEquPlanPerson(EquPlanPerson equPlanPerson);
/**
*
*
* @param equPlanPerson
* @return
*/
public int updateEquPlanPerson(EquPlanPerson equPlanPerson);
/**
*
*
* @param id
* @return
*/
public int deleteEquPlanPersonById(String id);
/**
*
*
* @param ids
* @return
*/
public int deleteEquPlanPersonByIds(String[] ids);
/**
* codelist
* @param planCode
* @return
*/
List<EquPlanPerson> selectEquPlanPersonByPlanCode(String planCode);
}

@ -58,4 +58,11 @@ public interface EquPlanStandardMapper {
* @return
*/
public int deleteEquPlanStandardByIds(String[] ids);
/**
* code
* @param planCode
* @return
*/
List<EquPlanStandard> selectEquPlanStandardByPlanCode(String planCode);
}

@ -83,4 +83,17 @@ public interface IEquPlanService {
* @return
*/
AjaxResult getPersonList();
/**
*
* @return
*/
AjaxResult getWorkCenter();
/**
*
* @param equPlan
* @return
*/
AjaxResult initUpdatePlanInfo(EquPlan equPlan);
}

@ -1,6 +1,8 @@
package com.op.device.service.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
@ -24,7 +26,7 @@ import static com.op.common.core.web.domain.AjaxResult.success;
/**
* Service
*
*
* @author Open Platform
* @date 2023-10-16
*/
@ -40,6 +42,14 @@ public class EquPlanServiceImpl implements IEquPlanService {
private SysUserMapper sysUserMapper;
@Autowired
private EquEquipmentMapper equEquipmentMapper;
@Autowired
private EquPlanPersonMapper equPlanPersonMapper;
@Autowired
private EquPlanStandardMapper equPlanStandardMapper;
@Autowired
private EquPlanDetailMapper equPlanDetailMapper;
@Autowired
private EquPlanEquMapper equPlanEquMapper;
/**
*
@ -111,9 +121,24 @@ public class EquPlanServiceImpl implements IEquPlanService {
equPlan.setUpdateBy(SecurityContextHolder.getUserName());
equPlan.setUpdateTime(DateUtils.getNowDate());
System.out.println("1");
// 处理计划-巡检人员信息
List<SysUser> personList = equPlan.getPersonList();
// TODO:处理计划-巡检人员信息
for (SysUser user : personList) {
EquPlanPerson equPlanPerson = new EquPlanPerson();
equPlanPerson.setId(IdUtils.fastSimpleUUID());
equPlanPerson.setUserId(user.getUserId());
equPlanPerson.setPlanCode(equPlan.getPlanCode());
equPlanPerson.setFactoryCode(factory);
equPlanPerson.setCreateBy(SecurityContextHolder.getUserName());
equPlanPerson.setCreateTime(DateUtils.getNowDate());
equPlanPerson.setUpdateBy(SecurityContextHolder.getUserName());
equPlanPerson.setUpdateTime(DateUtils.getNowDate());
equPlanPersonMapper.insertEquPlanPerson(equPlanPerson);
System.out.println("人员信息插入数据库成功");
}
// 处理计划1-n设备信息
List<EquPlanEqu> equipmentItemList = equPlan.getEquipmentItem();
@ -123,7 +148,8 @@ public class EquPlanServiceImpl implements IEquPlanService {
for (EquPlanEqu equipment : equipmentItemList) {
equipment.setId(IdUtils.fastSimpleUUID());
equipment.setCode("E"+equPlan.getPlanCode()+String.format("%02d", ++equipmentCodeTemp));
equipment.setPlanCode(equPlan.getPlanCode());
equipment.setCode("E" + equPlan.getPlanCode() + String.format("%02d", ++equipmentCodeTemp));
equipment.setParentCode(equPlan.getPlanCode());
equipment.setFactoryCode(factory);
equipment.setCreateBy(SecurityContextHolder.getUserName());
@ -131,7 +157,6 @@ public class EquPlanServiceImpl implements IEquPlanService {
equipment.setUpdateBy(SecurityContextHolder.getUserName());
equipment.setUpdateTime(DateUtils.getNowDate());
System.out.println("2");
// 处理检查项信息
List<EquCheckItem> equCheckItemList = equipment.getEquCheckItemList();
@ -141,49 +166,69 @@ public class EquPlanServiceImpl implements IEquPlanService {
for (EquCheckItem item : equCheckItemList) {
EquPlanDetail planDetail = new EquPlanDetail();
BeanUtils.copyProperties(item,planDetail);
BeanUtils.copyProperties(item, planDetail);
planDetail.setId(IdUtils.fastSimpleUUID());
planDetail.setCode("C"+equPlan.getPlanCode()+String.format("%02d", ++itemCodeTemp));
planDetail.setPlanCode(equPlan.getPlanCode());
planDetail.setCode("C" + equPlan.getPlanCode() + String.format("%02d", ++itemCodeTemp));
planDetail.setParentCode(equipment.getCode());
planDetail.setCreateBy(SecurityContextHolder.getUserName());
planDetail.setCreateTime(DateUtils.getNowDate());
planDetail.setUpdateBy(SecurityContextHolder.getUserName());
planDetail.setUpdateTime(DateUtils.getNowDate());
System.out.println("3");
// 处理检查项详情
// 处理标准
List<EquCheckItemDetail> equCheckItemDetailList = item.getEquCheckItemDetailList();
// 检查项详情流水号
int detailCodeTemp = 0;
// 判断是否插入检查项
boolean checkInsert = false;
for (EquCheckItemDetail detail : equCheckItemDetailList) {
EquPlanStandard planStandard = new EquPlanStandard();
BeanUtils.copyProperties(detail,planStandard);
if (detail.getShowFlag()) {
checkInsert = true;
planStandard.setId(IdUtils.fastSimpleUUID());
planStandard.setCode("D"+equPlan.getPlanCode()+String.format("%02d", ++detailCodeTemp));
planStandard.setCreateBy(SecurityContextHolder.getUserName());
planStandard.setCreateTime(DateUtils.getNowDate());
planStandard.setUpdateBy(SecurityContextHolder.getUserName());
planStandard.setUpdateTime(DateUtils.getNowDate());
EquPlanStandard planStandard = new EquPlanStandard();
BeanUtils.copyProperties(detail, planStandard);
// TODO 详情插入数据库
planStandard.setId(IdUtils.fastSimpleUUID());
planStandard.setParentCode(planDetail.getCode());
planStandard.setPlanCode(equPlan.getPlanCode());
planStandard.setCode("D" + equPlan.getPlanCode() + String.format("%02d", ++detailCodeTemp));
planStandard.setCreateBy(SecurityContextHolder.getUserName());
planStandard.setCreateTime(DateUtils.getNowDate());
planStandard.setUpdateBy(SecurityContextHolder.getUserName());
planStandard.setUpdateTime(DateUtils.getNowDate());
// 详情插入数据库
equPlanStandardMapper.insertEquPlanStandard(planStandard);
System.out.println("检查项详情插入数据库成功");
}
System.out.println("4");
}
// 检查项详情为空则不生成检查项信息-检查项插入数据库
if (checkInsert) {
equPlanDetailMapper.insertEquPlanDetail(planDetail);
System.out.println("检查项插入数据库成功");
}
// TODO 检查项详情为空则不生成检查项信息-检查项插入数据库
}
// TODO 设备插入数据库
// 设备插入数据库
equPlanEquMapper.insertEquPlanEqu(equipment);
System.out.println("设备信息插入数据库成功");
}
// 主计划插入数据库
equPlanMapper.insertEquPlan(equPlan);
System.out.println("巡检主计划插入数据库成功");
return success();
}
@ -226,6 +271,7 @@ public class EquPlanServiceImpl implements IEquPlanService {
/**
* list
*
* @param equEquipment
* @return
*/
@ -273,6 +319,7 @@ public class EquPlanServiceImpl implements IEquPlanService {
/**
* list
*
* @return
*/
@Override
@ -282,4 +329,79 @@ public class EquPlanServiceImpl implements IEquPlanService {
List<SysUser> personList = sysUserMapper.selectSysUserList(sysUser);
return success(personList);
}
/**
*
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult getWorkCenter() {
//获取当前所选工厂
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
String str = request.getHeader(key.substring(8));
int index = str.indexOf("_");
String factory = str.substring(index + 1);
equPlanMapper.selectWorkCenter(factory);
return success(equPlanMapper.selectWorkCenter(factory));
}
/**
*
* @param equPlan
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult initUpdatePlanInfo(EquPlan equPlan) {
// 获取计划信息
EquPlan plan = equPlanMapper.selectEquPlanByPlanCode(equPlan.getPlanCode());
// 处理计划信息
List<Date> planTimeArray = new ArrayList<>();
planTimeArray.add(plan.getPlanLoopStart());
planTimeArray.add(plan.getPlanLoopEnd());
plan.setPlanTimeArray(planTimeArray);
// 获取人员信息
List<EquPlanPerson> personList = equPlanPersonMapper.selectEquPlanPersonByPlanCode(equPlan.getPlanCode());
List<Long> persons = new ArrayList<>();
for (EquPlanPerson person : personList) {
persons.add(person.getUserId());
}
// 获取设备信息
List<EquPlanEqu> equipmentList = equPlanEquMapper.selectEquPlanEquByPlanCode(equPlan.getPlanCode());
for (EquPlanEqu equipment : equipmentList) {
// 获取检查项list
EquPlanDetail selectDetail = new EquPlanDetail();
selectDetail.setParentCode(equipment.getCode());
selectDetail.setPlanCode(equPlan.getPlanCode());
List<EquPlanDetail> detailList = equPlanDetailMapper.selectEquPlanDetailList(selectDetail);
for (EquPlanDetail detail : detailList) {
// 获取标准list
EquPlanStandard selectStandard = new EquPlanStandard();
selectStandard.setParentCode(detail.getCode());
selectStandard.setPlanCode(equPlan.getPlanCode());
List<EquPlanStandard> standardList = equPlanStandardMapper.selectEquPlanStandardList(selectStandard);
// 置入标准
detail.setEquPlanStandardList(standardList);
}
// 置入检查项
equipment.setEquPlanDetailList(detailList);
}
plan.setEquipmentItem(equipmentList);
plan.setPersonListVO(persons);
return success(plan);
}
}

@ -8,6 +8,7 @@
<result property="id" column="id" />
<result property="code" column="code" />
<result property="planId" column="plan_id" />
<result property="planCode" column="plan_code" />
<result property="parentCode" column="parent_code" />
<result property="itemCode" column="item_code" />
<result property="itemName" column="item_name" />
@ -27,7 +28,7 @@
</resultMap>
<sql id="selectEquPlanDetailVo">
select id, code, plan_id, parent_code, item_code, item_name, item_method, item_type, item_type_name, item_remark, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_plan_detail
select id, code, plan_id,plan_code, parent_code, item_code, item_name, item_method, item_type, item_type_name, item_remark, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_plan_detail
</sql>
<select id="selectEquPlanDetailList" parameterType="EquPlanDetail" resultMap="EquPlanDetailResult">
@ -35,6 +36,7 @@
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="planId != null and planId != ''"> and plan_id = #{planId}</if>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
<if test="parentCode != null and parentCode != ''"> and parent_code = #{parentCode}</if>
<if test="itemCode != null and itemCode != ''"> and item_code = #{itemCode}</if>
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
@ -54,12 +56,18 @@
where id = #{id}
</select>
<select id="selectEquPlanDetailByPlanCode" parameterType="String" resultMap="EquPlanDetailResult">
<include refid="selectEquPlanDetailVo"/>
where plan_code = #{planCode} and del_flag = '0'
</select>
<insert id="insertEquPlanDetail" parameterType="EquPlanDetail">
insert into equ_plan_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="code != null">code,</if>
<if test="planId != null">plan_id,</if>
<if test="planCode != null">plan_code,</if>
<if test="parentCode != null">parent_code,</if>
<if test="itemCode != null">item_code,</if>
<if test="itemName != null">item_name,</if>
@ -81,6 +89,7 @@
<if test="id != null">#{id},</if>
<if test="code != null">#{code},</if>
<if test="planId != null">#{planId},</if>
<if test="planCode != null">#{planCode},</if>
<if test="parentCode != null">#{parentCode},</if>
<if test="itemCode != null">#{itemCode},</if>
<if test="itemName != null">#{itemName},</if>
@ -105,6 +114,7 @@
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">code = #{code},</if>
<if test="planId != null">plan_id = #{planId},</if>
<if test="planCode != null">plan_code = #{planCode},</if>
<if test="parentCode != null">parent_code = #{parentCode},</if>
<if test="itemCode != null">item_code = #{itemCode},</if>
<if test="itemName != null">item_name = #{itemName},</if>

@ -7,6 +7,7 @@
<resultMap type="EquPlanEqu" id="EquPlanEquResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="planCode" column="plan_code" />
<result property="parentCode" column="parent_code" />
<result property="equipmentCode" column="equipment_code" />
<result property="equipmentName" column="equipment_name" />
@ -22,13 +23,14 @@
</resultMap>
<sql id="selectEquPlanEquVo">
select id, code, parent_code, equipment_code, equipment_name, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_plan_equ
select id, code, parent_code,plan_code, equipment_code, equipment_name, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_plan_equ
</sql>
<select id="selectEquPlanEquList" parameterType="EquPlanEqu" resultMap="EquPlanEquResult">
<include refid="selectEquPlanEquVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
<if test="parentCode != null and parentCode != ''"> and parent_code = #{parentCode}</if>
<if test="equipmentCode != null and equipmentCode != ''"> and equipment_code = #{equipmentCode}</if>
<if test="equipmentName != null and equipmentName != ''"> and equipment_name like concat('%', #{equipmentName}, '%')</if>
@ -44,12 +46,18 @@
where id = #{id}
</select>
<select id="selectEquPlanEquByPlanCode" parameterType="String" resultMap="EquPlanEquResult">
<include refid="selectEquPlanEquVo"/>
where plan_code = #{planCode} and del_flag = '0'
</select>
<insert id="insertEquPlanEqu" parameterType="EquPlanEqu">
insert into equ_plan_equ
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="code != null and code != ''">code,</if>
<if test="parentCode != null and parentCode != ''">parent_code,</if>
<if test="planCode != null and planCode != ''">plan_code,</if>
<if test="equipmentCode != null and equipmentCode != ''">equipment_code,</if>
<if test="equipmentName != null and equipmentName != ''">equipment_name,</if>
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
@ -66,6 +74,7 @@
<if test="id != null">#{id},</if>
<if test="code != null and code != ''">#{code},</if>
<if test="parentCode != null and parentCode != ''">#{parentCode},</if>
<if test="planCode != null and planCode != ''">#{planCode},</if>
<if test="equipmentCode != null and equipmentCode != ''">#{equipmentCode},</if>
<if test="equipmentName != null and equipmentName != ''">#{equipmentName},</if>
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
@ -85,6 +94,7 @@
<trim prefix="SET" suffixOverrides=",">
<if test="code != null and code != ''">code = #{code},</if>
<if test="parentCode != null and parentCode != ''">parent_code = #{parentCode},</if>
<if test="planCode != null and planCode != ''">plan_code = #{planCode},</if>
<if test="equipmentCode != null and equipmentCode != ''">equipment_code = #{equipmentCode},</if>
<if test="equipmentName != null and equipmentName != ''">equipment_name = #{equipmentName},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>

@ -81,6 +81,17 @@
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and del_flag = '0'
</select>
<select id="selectWorkCenter" resultType="com.op.device.domain.WorkCenter">
select factory_id AS 'factoryId', factory_name AS 'factoryName', factory_code AS 'factoryCode', f_type AS 'fType'
from sys_factory
where parent_id = (select factory_id from sys_factory where factory_code = #{factory}) and f_type = 'c'
</select>
<select id="selectEquPlanByPlanCode" parameterType="String" resultMap="EquPlanResult">
<include refid="selectEquPlanVo"/>
where plan_code = #{planCode} and del_flag = '0'
</select>
<insert id="insertEquPlan" parameterType="EquPlan">
insert into equ_plan
<trim prefix="(" suffix=")" suffixOverrides=",">

@ -0,0 +1,113 @@
<?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.op.device.mapper.EquPlanPersonMapper">
<resultMap type="EquPlanPerson" id="EquPlanPersonResult">
<result property="id" column="id" />
<result property="planCode" column="plan_code" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="factoryCode" column="factory_code" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<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" />
</resultMap>
<sql id="selectEquPlanPersonVo">
select id, plan_code, user_id, user_name, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_plan_person
</sql>
<select id="selectEquPlanPersonList" parameterType="EquPlanPerson" resultMap="EquPlanPersonResult">
<include refid="selectEquPlanPersonVo"/>
<where>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</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="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
</where>
</select>
<select id="selectEquPlanPersonById" parameterType="String" resultMap="EquPlanPersonResult">
<include refid="selectEquPlanPersonVo"/>
where id = #{id}
</select>
<select id="selectEquPlanPersonByPlanCode" parameterType="String" resultMap="EquPlanPersonResult">
<include refid="selectEquPlanPersonVo"/>
where plan_code = #{planCode} and del_flag = '0'
</select>
<insert id="insertEquPlanPerson" parameterType="EquPlanPerson">
insert into equ_plan_person
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="planCode != null and planCode != ''">plan_code,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="planCode != null and planCode != ''">#{planCode},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateEquPlanPerson" parameterType="EquPlanPerson">
update equ_plan_person
<trim prefix="SET" suffixOverrides=",">
<if test="planCode != null and planCode != ''">plan_code = #{planCode},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEquPlanPersonById" parameterType="String">
delete from equ_plan_person where id = #{id}
</delete>
<delete id="deleteEquPlanPersonByIds" parameterType="String">
delete from equ_plan_person where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -8,6 +8,7 @@
<result property="id" column="id" />
<result property="code" column="code" />
<result property="parentCode" column="parent_code" />
<result property="planCode" column="plan_code" />
<result property="detailCode" column="detail_code" />
<result property="standardType" column="standard_type" />
<result property="standardName" column="standard_name" />
@ -26,7 +27,7 @@
</resultMap>
<sql id="selectEquPlanStandardVo">
select id, code, parent_code, detail_code, standard_type, standard_name, detail_up_limit, detail_down_limit, detail_unit, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_plan_standard
select id, code, parent_code,plan_code, detail_code, standard_type, standard_name, detail_up_limit, detail_down_limit, detail_unit, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_plan_standard
</sql>
<select id="selectEquPlanStandardList" parameterType="EquPlanStandard" resultMap="EquPlanStandardResult">
@ -34,6 +35,7 @@
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="parentCode != null and parentCode != ''"> and parent_code = #{parentCode}</if>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
<if test="detailCode != null and detailCode != ''"> and detail_code = #{detailCode}</if>
<if test="standardType != null and standardType != ''"> and standard_type = #{standardType}</if>
<if test="standardName != null and standardName != ''"> and standard_name like concat('%', #{standardName}, '%')</if>
@ -52,12 +54,18 @@
where id = #{id}
</select>
<select id="selectEquPlanStandardByPlanCode" parameterType="String" resultMap="EquPlanStandardResult">
<include refid="selectEquPlanStandardVo"/>
where plan_code = #{planCode} and del_flag ='0'
</select>
<insert id="insertEquPlanStandard" parameterType="EquPlanStandard">
insert into equ_plan_standard
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="code != null">code,</if>
<if test="parentCode != null">parent_code,</if>
<if test="planCode != null">plan_code,</if>
<if test="detailCode != null">detail_code,</if>
<if test="standardType != null">standard_type,</if>
<if test="standardName != null">standard_name,</if>
@ -78,6 +86,7 @@
<if test="id != null">#{id},</if>
<if test="code != null">#{code},</if>
<if test="parentCode != null">#{parentCode},</if>
<if test="planCode != null">#{planCode},</if>
<if test="detailCode != null">#{detailCode},</if>
<if test="standardType != null">#{standardType},</if>
<if test="standardName != null">#{standardName},</if>
@ -101,6 +110,7 @@
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">code = #{code},</if>
<if test="parentCode != null">parent_code = #{parentCode},</if>
<if test="planCode != null">plan_code = #{planCode},</if>
<if test="detailCode != null">detail_code = #{detailCode},</if>
<if test="standardType != null">standard_type = #{standardType},</if>
<if test="standardName != null">standard_name = #{standardName},</if>

Loading…
Cancel
Save