检验节点维护

highway
shaoyong 1 year ago
parent b1d37a7c79
commit cd3d3bd928

@ -0,0 +1,97 @@
package com.op.quality.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.quality.domain.QcCheckType;
import com.op.quality.service.IQcCheckTypeService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author Open Platform
* @date 2023-10-12
*/
@RestController
@RequestMapping("/checkType")
public class QcCheckTypeController extends BaseController {
@Autowired
private IQcCheckTypeService qcCheckTypeService;
/**
*
*/
@RequiresPermissions("quality:checkType:list")
@GetMapping("/list")
public TableDataInfo list(QcCheckType qcCheckType) {
startPage();
List<QcCheckType> list = qcCheckTypeService.selectQcCheckTypeList(qcCheckType);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("quality:checkType:export")
@Log(title = "检验节点维护", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcCheckType qcCheckType) {
List<QcCheckType> list = qcCheckTypeService.selectQcCheckTypeList(qcCheckType);
ExcelUtil<QcCheckType> util = new ExcelUtil<QcCheckType>(QcCheckType.class);
util.exportExcel(response, list, "检验节点维护数据");
}
/**
*
*/
@RequiresPermissions("quality:checkType:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(qcCheckTypeService.selectQcCheckTypeById(id));
}
/**
*
*/
@RequiresPermissions("quality:checkType:add")
@Log(title = "检验节点维护", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QcCheckType qcCheckType) {
return toAjax(qcCheckTypeService.insertQcCheckType(qcCheckType));
}
/**
*
*/
@RequiresPermissions("quality:checkType:edit")
@Log(title = "检验节点维护", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QcCheckType qcCheckType) {
return toAjax(qcCheckTypeService.updateQcCheckType(qcCheckType));
}
/**
*
*/
@RequiresPermissions("quality:checkType:remove")
@Log(title = "检验节点维护", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(qcCheckTypeService.deleteQcCheckTypeByIds(ids));
}
}

@ -0,0 +1,126 @@
package com.op.quality.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.quality.domain.QcUserMaterial;
import com.op.quality.service.IQcUserMaterialService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author Open Platform
* @date 2023-10-09
*/
@RestController
@RequestMapping("/material")
public class QcUserMaterialController extends BaseController {
@Autowired
private IQcUserMaterialService qcUserMaterialService;
/**
*
*/
@RequiresPermissions("quality:material:list")
@GetMapping("/userList")
public TableDataInfo userList(QcUserMaterial qcUserMaterial) {
startPage();
List<QcUserMaterial> list = qcUserMaterialService.selectUserList(qcUserMaterial);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/list")
public TableDataInfo list(QcUserMaterial qcUserMaterial) {
startPage();
List<QcUserMaterial> list = qcUserMaterialService.selectQcUserMaterialList(qcUserMaterial);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("quality:material:export")
@Log(title = "人员物料绑定", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcUserMaterial qcUserMaterial) {
List<QcUserMaterial> list = qcUserMaterialService.selectQcUserMaterialList(qcUserMaterial);
ExcelUtil<QcUserMaterial> util = new ExcelUtil<QcUserMaterial>(QcUserMaterial.class);
util.exportExcel(response, list, "人员物料绑定数据");
}
/**
*
*/
@RequiresPermissions("quality:material:query")
@GetMapping(value = "/{userCode}")
public AjaxResult getInfo(@PathVariable("userCode") String userCode) {
return success(qcUserMaterialService.selectUserByUserCode(userCode));
}
/**
*
*/
@RequiresPermissions("quality:material:add")
@Log(title = "人员物料绑定", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QcUserMaterial qcUserMaterial) {
return toAjax(qcUserMaterialService.insertQcUserMaterial(qcUserMaterial));
}
/**
*
*/
@RequiresPermissions("quality:material:edit")
@Log(title = "人员物料绑定", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QcUserMaterial qcUserMaterial) {
return toAjax(qcUserMaterialService.updateQcUserMaterial(qcUserMaterial));
}
/**
*
*/
@RequiresPermissions("quality:material:remove")
@Log(title = "人员物料绑定", businessType = BusinessType.DELETE)
@DeleteMapping("/{userCodes}")
public AjaxResult remove(@PathVariable String[] userCodes) {
return toAjax(qcUserMaterialService.deleteQcUserMaterialByUserCodes(userCodes));
}
/**
* 穿
*/
@GetMapping(value = "/getList")
public TableDataInfo getList(QcUserMaterial qcUserMaterial) {
startPage();
List<QcUserMaterial> list = qcUserMaterialService.getList(qcUserMaterial);
return getDataTable(list);
}
/**
* 穿
*/
@GetMapping(value = "/getRightList")
public TableDataInfo getRightList(QcUserMaterial qcUserMaterial) {
startPage();
List<QcUserMaterial> list = qcUserMaterialService.getRightList(qcUserMaterial);
return getDataTable(list);
}
}

@ -0,0 +1,121 @@
package com.op.quality.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;
/**
* qc_check_type
*
* @author Open Platform
* @date 2023-10-12
*/
public class QcCheckType extends BaseEntity {
private static final long serialVersionUID = 1L;
/** id */
private String id;
/** 流程编号 */
@Excel(name = "流程编号")
private String orderCode;
/** 名称 */
@Excel(name = "名称")
private String checkName;
/** 类型编码 */
@Excel(name = "类型编码")
private String typeCode;
/** 类型名称 */
@Excel(name = "类型名称")
private String typeName;
/** 预留字段1 */
@Excel(name = "预留字段1")
private String attr1;
/** 工厂编码 */
@Excel(name = "工厂编码")
private String factoryCode;
/** 删除标识1删除0正常 */
private String delFlag;
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getOrderCode() {
return orderCode;
}
public void setCheckName(String checkName) {
this.checkName = checkName;
}
public String getCheckName() {
return checkName;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public String getTypeCode() {
return typeCode;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getTypeName() {
return typeName;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1() {
return attr1;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
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("order", getOrderCode())
.append("checkName", getCheckName())
.append("typeCode", getTypeCode())
.append("typeName", getTypeName())
.append("attr1", getAttr1())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("factoryCode", getFactoryCode())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,258 @@
package com.op.quality.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;
import java.util.List;
/**
* qc_user_material
*
* @author Open Platform
* @date 2023-10-09
*/
public class QcUserMaterial extends BaseEntity {
private static final long serialVersionUID = 1L;
/** id */
private String id;
/** 员工编码 */
@Excel(name = "员工编码")
private String userCode;
/** 员工名称 */
@Excel(name = "员工名称")
private String userName;
/** 物料编码 */
@Excel(name = "物料编码")
private String materialCode;
/** 物料名称 */
@Excel(name = "物料名称")
private String materialName;
/** 预留字段1 */
@Excel(name = "预留字段1")
private String attr1;
/** 预留字段2 */
@Excel(name = "预留字段2")
private String attr2;
/** 预留字段3 */
@Excel(name = "预留字段3")
private String attr3;
/** 预留字段4 */
@Excel(name = "预留字段4")
private String attr4;
/** 工厂编码 */
@Excel(name = "工厂编码")
private String factoryCode;
/** 删除标识1删除0正常 */
private String delFlag;
/** 编号 */
private String userId;
/** 手机号 */
private String phonenumber;
private String email;
private String materialNames;
/** 状态 */
private String status;
private String materialId;
private String[] userCodes;
private String label;
private String key;
private List<String> selectedValues;
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
public String getUserCode() {
return userCode;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserName() {
return userName;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialName() {
return materialName;
}
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 setAttr4(String attr4) {
this.attr4 = attr4;
}
public String getAttr4() {
return attr4;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getPhonenumber() {
return phonenumber;
}
public void setPhonenumber(String phonenumber) {
this.phonenumber = phonenumber;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getMaterialNames() {
return materialNames;
}
public void setMaterialNames(String materialNames) {
this.materialNames = materialNames;
}
public String getMaterialId() {
return materialId;
}
public void setMaterialId(String materialId) {
this.materialId = materialId;
}
public String[] getUserCodes() {
return userCodes;
}
public void setUserCodes(String[] userCodes) {
this.userCodes = userCodes;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public List<String> getSelectedValues() {
return selectedValues;
}
public void setSelectedValues(List<String> selectedValues) {
this.selectedValues = selectedValues;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userCode", getUserCode())
.append("userName", getUserName())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("userId", getUserId())
.append("phonenumber", getPhonenumber())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("factoryCode", getFactoryCode())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,63 @@
package com.op.quality.mapper;
import java.util.List;
import com.op.quality.domain.QcCheckType;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
*
* @author Open Platform
* @date 2023-10-12
*/
@Mapper
public interface QcCheckTypeMapper {
/**
*
*
* @param id
* @return
*/
public QcCheckType selectQcCheckTypeById(String id);
/**
*
*
* @param qcCheckType
* @return
*/
public List<QcCheckType> selectQcCheckTypeList(QcCheckType qcCheckType);
/**
*
*
* @param qcCheckType
* @return
*/
public int insertQcCheckType(QcCheckType qcCheckType);
/**
*
*
* @param qcCheckType
* @return
*/
public int updateQcCheckType(QcCheckType qcCheckType);
/**
*
*
* @param id
* @return
*/
public int deleteQcCheckTypeById(String id);
/**
*
*
* @param ids
* @return
*/
public int deleteQcCheckTypeByIds(String[] ids);
}

@ -0,0 +1,78 @@
package com.op.quality.mapper;
import java.util.List;
import com.op.quality.domain.QcUserMaterial;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
*
* @author Open Platform
* @date 2023-10-09
*/
@Mapper
public interface QcUserMaterialMapper {
/**
*
*/
public List<QcUserMaterial> selectUserList(QcUserMaterial qcUserMaterial);
/**
*
*
* @param id
* @return
*/
public QcUserMaterial selectQcUserMaterialById(String id);
/**
*
*
* @param userCode
* @return
*/
public QcUserMaterial selectUserByUserCode(String userCode);
/**
*
*
* @param qcUserMaterial
* @return
*/
public List<QcUserMaterial> selectQcUserMaterialList(QcUserMaterial qcUserMaterial);
/**
*
*
* @param qcUserMaterial
* @return
*/
public int insertQcUserMaterial(QcUserMaterial qcUserMaterial);
/**
*
*
* @param qcUserMaterial
* @return
*/
public int updateQcUserMaterial(QcUserMaterial qcUserMaterial);
/**
*
*
* @param qcUserMaterial
* @return
*/
public int deleteQcUserMaterialByUserCode(QcUserMaterial qcUserMaterial);
/**
*
*
* @param userCodes
* @return
*/
public int deleteQcUserMaterialByUserCodes(String[] userCodes);
public List<QcUserMaterial> getUserMaterialListUndo(QcUserMaterial qcUserMaterial);
public List<QcUserMaterial> getUserMaterialListDo(QcUserMaterial qcUserMaterial);
}

@ -0,0 +1,60 @@
package com.op.quality.service;
import java.util.List;
import com.op.quality.domain.QcCheckType;
/**
* Service
*
* @author Open Platform
* @date 2023-10-12
*/
public interface IQcCheckTypeService {
/**
*
*
* @param id
* @return
*/
public QcCheckType selectQcCheckTypeById(String id);
/**
*
*
* @param qcCheckType
* @return
*/
public List<QcCheckType> selectQcCheckTypeList(QcCheckType qcCheckType);
/**
*
*
* @param qcCheckType
* @return
*/
public int insertQcCheckType(QcCheckType qcCheckType);
/**
*
*
* @param qcCheckType
* @return
*/
public int updateQcCheckType(QcCheckType qcCheckType);
/**
*
*
* @param ids
* @return
*/
public int deleteQcCheckTypeByIds(String[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteQcCheckTypeById(String id);
}

@ -0,0 +1,78 @@
package com.op.quality.service;
import java.util.List;
import com.op.quality.domain.QcUserMaterial;
/**
* Service
*
* @author Open Platform
* @date 2023-10-09
*/
public interface IQcUserMaterialService {
/**
*
*
* @param qcUserMaterial
* @return
*/
public List<QcUserMaterial> selectUserList(QcUserMaterial qcUserMaterial);
/**
*
*
* @param userCode
* @return
*/
public QcUserMaterial selectQcUserMaterialById(String userCode);
/**
*
*
* @param userCode
* @return
*/
public QcUserMaterial selectUserByUserCode(String userCode);
public List<QcUserMaterial> getList(QcUserMaterial qcUserMaterial);
/**
*
*
* @param qcUserMaterial
* @return
*/
public List<QcUserMaterial> selectQcUserMaterialList(QcUserMaterial qcUserMaterial);
/**
*
*
* @param qcUserMaterial
* @return
*/
public int insertQcUserMaterial(QcUserMaterial qcUserMaterial);
/**
*
*
* @param qcUserMaterial
* @return
*/
public int updateQcUserMaterial(QcUserMaterial qcUserMaterial);
/**
*
*
* @param userCodes
* @return
*/
public int deleteQcUserMaterialByUserCodes(String[] userCodes);
/**
*
*
* @param qcUserMaterial
* @return
*/
public int deleteQcUserMaterialByUserCode(QcUserMaterial qcUserMaterial);
public List<QcUserMaterial> getRightList(QcUserMaterial qcUserMaterial);
}

@ -0,0 +1,113 @@
package com.op.quality.service.serviceImpl;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.quality.mapper.QcCheckTypeMapper;
import com.op.quality.domain.QcCheckType;
import com.op.quality.service.IQcCheckTypeService;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* Service
*
* @author Open Platform
* @date 2023-10-12
*/
@Service
public class QcCheckTypeServiceImpl implements IQcCheckTypeService {
@Autowired
private QcCheckTypeMapper qcCheckTypeMapper;
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public QcCheckType selectQcCheckTypeById(String id) {
return qcCheckTypeMapper.selectQcCheckTypeById(id);
}
/**
*
*
* @param qcCheckType
* @return
*/
@Override
@DS("#header.poolName")
public List<QcCheckType> selectQcCheckTypeList(QcCheckType qcCheckType) {
return qcCheckTypeMapper.selectQcCheckTypeList(qcCheckType);
}
/**
*
*
* @param qcCheckType
* @return
*/
@Override
@DS("#header.poolName")
public int insertQcCheckType(QcCheckType qcCheckType) {
if (StringUtils.isNotBlank(qcCheckType.getCheckName())){
qcCheckType.setId(IdUtils.fastSimpleUUID());
qcCheckType.setCreateBy(SecurityUtils.getUsername());
qcCheckType.setCreateTime(DateUtils.getNowDate());
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
qcCheckType.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
}
return qcCheckTypeMapper.insertQcCheckType(qcCheckType);
}
/**
*
*
* @param qcCheckType
* @return
*/
@Override
@DS("#header.poolName")
public int updateQcCheckType(QcCheckType qcCheckType) {
qcCheckType.setUpdateTime(DateUtils.getNowDate());
qcCheckType.setUpdateBy(SecurityUtils.getUsername());
return qcCheckTypeMapper.updateQcCheckType(qcCheckType);
}
/**
*
*
* @param ids
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcCheckTypeByIds(String[] ids) {
return qcCheckTypeMapper.deleteQcCheckTypeByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcCheckTypeById(String id) {
return qcCheckTypeMapper.deleteQcCheckTypeById(id);
}
}

@ -0,0 +1,167 @@
package com.op.quality.service.serviceImpl;
import java.util.Date;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.quality.mapper.QcUserMaterialMapper;
import com.op.quality.domain.QcUserMaterial;
import com.op.quality.service.IQcUserMaterialService;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* Service
*
* @author Open Platform
* @date 2023-10-09
*/
@Service
public class QcUserMaterialServiceImpl implements IQcUserMaterialService {
@Autowired
private QcUserMaterialMapper qcUserMaterialMapper;
@Override
public List<QcUserMaterial> selectUserList(QcUserMaterial qcUserMaterial) {
return qcUserMaterialMapper.selectUserList( qcUserMaterial);
}
/**
*
*
* @param userCode
* @return
*/
@Override
@DS("#header.poolName")
public QcUserMaterial selectQcUserMaterialById(String userCode) {
return qcUserMaterialMapper.selectQcUserMaterialById(userCode);
}
@Override
public QcUserMaterial selectUserByUserCode(String userCode) {
return qcUserMaterialMapper.selectUserByUserCode(userCode);
}
/**
*
*
* @param qcUserMaterial
* @return
*/
@Override
@DS("#header.poolName")
public List<QcUserMaterial> selectQcUserMaterialList(QcUserMaterial qcUserMaterial) {
return qcUserMaterialMapper.selectQcUserMaterialList(qcUserMaterial);
}
/**
*
*
* @param qcUserMaterial
* @return
*/
@Override
@DS("#header.poolName")
public int insertQcUserMaterial(QcUserMaterial qcUserMaterial) {
Date now = DateUtils.getNowDate();
if (StringUtils.isNotEmpty(qcUserMaterial.getUserCodes())) {
//删除之前的关联关系
qcUserMaterialMapper.deleteQcUserMaterialByUserCodes(qcUserMaterial.getUserCodes());
}
if (qcUserMaterial.getSelectedValues()!=null) {
QcUserMaterial qcUserMaterialDto = null;
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
for (String userCode : qcUserMaterial.getUserCodes()) {
for (String materialCode : qcUserMaterial.getSelectedValues()) {
//查询物料编码对应的各种信息
qcUserMaterialDto = new QcUserMaterial();
qcUserMaterialDto.setId(IdUtils.fastSimpleUUID());
qcUserMaterialDto.setCreateTime(now);
qcUserMaterialDto.setCreateBy(SecurityUtils.getUsername());
qcUserMaterialDto.setUserCode(userCode);
qcUserMaterialDto.setUserName(qcUserMaterial.getUserName());
qcUserMaterialDto.setMaterialCode(materialCode);
qcUserMaterialDto.setMaterialName(qcUserMaterial.getMaterialName());
qcUserMaterialDto.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
qcUserMaterialMapper.insertQcUserMaterial(qcUserMaterialDto);
}
}
}
return 1;
}
/**
*
*
* @param qcUserMaterial
* @return
*/
@Override
@DS("#header.poolName")
public int updateQcUserMaterial(QcUserMaterial qcUserMaterial) {
qcUserMaterial.setUpdateTime(DateUtils.getNowDate());
return qcUserMaterialMapper.updateQcUserMaterial(qcUserMaterial);
}
/**
*
*
* @param userCodes
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcUserMaterialByUserCodes(String[] userCodes) {
return qcUserMaterialMapper.deleteQcUserMaterialByUserCodes(userCodes);
}
/**
*
*
* @param qcUserMaterial
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcUserMaterialByUserCode(QcUserMaterial qcUserMaterial) {
return qcUserMaterialMapper.deleteQcUserMaterialByUserCode(qcUserMaterial);
}
@Override
@DS("#header.poolName")
public List<QcUserMaterial> getList(QcUserMaterial qcUserMaterial) {
List<QcUserMaterial> dto = qcUserMaterialMapper.getUserMaterialListUndo(qcUserMaterial);
List<QcUserMaterial> selected = qcUserMaterialMapper.getUserMaterialListDo(qcUserMaterial);
dto.addAll(selected);
dto.forEach(item -> {
item.setKey(item.getMaterialCode());
});
return dto;
}
@Override
@DS("#header.poolName")
public List<QcUserMaterial> getRightList(QcUserMaterial qcUserMaterial) {
List<QcUserMaterial> selected = qcUserMaterialMapper.getUserMaterialListDo(qcUserMaterial);
selected.forEach(item -> {
item.setKey(item.getMaterialCode());
});
return selected;
}
}

@ -0,0 +1,104 @@
<?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.quality.mapper.QcCheckTypeMapper">
<resultMap type="QcCheckType" id="QcCheckTypeResult">
<result property="id" column="id" />
<result property="orderCode" column="order_code" />
<result property="checkName" column="check_name" />
<result property="typeCode" column="type_code" />
<result property="typeName" column="type_name" />
<result property="attr1" column="attr1" />
<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="factoryCode" column="factory_code" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectQcCheckTypeVo">
select id, order_code, check_name, type_code, type_name, attr1, create_by, create_time, update_by, update_time, factory_code, del_flag from qc_check_type
</sql>
<select id="selectQcCheckTypeList" parameterType="QcCheckType" resultMap="QcCheckTypeResult">
<include refid="selectQcCheckTypeVo"/>
<where>
<if test="orderCode != null and orderCode != ''"> and order_code = #{orderCode}</if>
<if test="checkName != null and checkName != ''"> and check_name like concat('%', #{checkName}, '%')</if>
<if test="typeCode != null and typeCode != ''"> and type_code = #{typeCode}</if>
<if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
</where>
order by create_time
</select>
<select id="selectQcCheckTypeById" parameterType="String" resultMap="QcCheckTypeResult">
<include refid="selectQcCheckTypeVo"/>
where id = #{id}
</select>
<insert id="insertQcCheckType" parameterType="QcCheckType">
insert into qc_check_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="orderCode != null">order_code,</if>
<if test="checkName != null">check_name,</if>
<if test="typeCode != null">type_code,</if>
<if test="typeName != null">type_name,</if>
<if test="attr1 != null">attr1,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="orderCode != null">#{orderCode},</if>
<if test="checkName != null">#{checkName},</if>
<if test="typeCode != null">#{typeCode},</if>
<if test="typeName != null">#{typeName},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateQcCheckType" parameterType="QcCheckType">
update qc_check_type
<trim prefix="SET" suffixOverrides=",">
<if test="orderCode != null">order_code = #{orderCode},</if>
<if test="checkName != null">check_name = #{checkName},</if>
<if test="typeCode != null">type_code = #{typeCode},</if>
<if test="typeName != null">type_name = #{typeName},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteQcCheckTypeById" parameterType="String">
delete from qc_check_type where id = #{id}
</delete>
<delete id="deleteQcCheckTypeByIds" parameterType="String">
delete from qc_check_type where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,181 @@
<?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.quality.mapper.QcUserMaterialMapper">
<resultMap type="QcUserMaterial" id="QcUserMaterialResult">
<result property="id" column="id" />
<result property="userCode" column="user_code" />
<result property="userName" column="user_name" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="userId" column="user_id"/>
<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="factoryCode" column="factory_code" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectQcUserMaterialVo">
select id, user_code, user_name, material_code, material_name, attr1, attr2, attr3, attr4,
create_by, create_time, update_by, update_time, factory_code, del_flag from qc_user_material
</sql>
<select id="selectUserList" parameterType="QcUserMaterial" resultMap="QcUserMaterialResult">
SELECT
t.user_id,
t.user_name as user_code,
t.nick_name as user_name,
t.phonenumber,
t.email,
STRING_AGG(bp.product_desc_zh, ',') materialNames,
t.status,
t.create_time
FROM
sys_user t
LEFT JOIN lanju_op_xiaolan_ds.dbo.qc_user_material um ON um.user_code = t.user_name
LEFT JOIN base_product bp ON bp.product_code = um.material_code
GROUP BY t.user_id,t.user_name,t.nick_name,t.phonenumber,t.email,t.status,t.create_time
</select>
<select id="selectQcUserMaterialList" parameterType="QcUserMaterial" resultMap="QcUserMaterialResult">
<include refid="selectQcUserMaterialVo"/>
<where>
<if test="userCode != null and userCode != ''"> and user_code = #{userCode}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</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>
<if test="attr4 != null and attr4 != ''"> and attr4 = #{attr4}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
</where>
</select>
<select id="selectUserByUserCode" parameterType="QcUserMaterial" resultMap="QcUserMaterialResult">
SELECT
user_id,
user_name as user_code,
nick_name as user_name,
phonenumber,
create_time
FROM sys_user
WHERE user_name = #{userCode}
</select>
<select id="selectQcUserMaterialById" parameterType="String" resultMap="QcUserMaterialResult">
<include refid="selectQcUserMaterialVo"/>
where id = #{id}
</select>
<select id="getUserMaterialListUndo" resultType="com.op.quality.domain.QcUserMaterial">
select
bp.product_code materialCode,
concat(bp.product_desc_zh,'(',bp.product_code,')') label,
concat(bp.product_desc_zh,'(',bp.product_code,')') materialName,
bp.product_id materialId
from base_product bp
where bp.active_flag = '1' and bp.del_flag = '0'
and bp.product_code not in (
select um.material_code
from qc_user_material um
where um.user_code in
<foreach item="userCode" collection="userCodes" open="(" separator="," close=")">
#{userCode}
</foreach>
)
<if test="materialName != null and materialName != ''"> and bp.product_desc_zh like concat('%', #{materialName}, '%')</if>
</select>
<select id="getUserMaterialListDo" resultType="com.op.quality.domain.QcUserMaterial">
select distinct um.material_code materialCode,
concat(bp.product_desc_zh,'(',bp.product_code,')') label
from qc_user_material um
left join base_product bp on um.material_code = bp.product_code
where um.user_code in
<foreach item="userCode" collection="userCodes" open="(" separator="," close=")">
#{userCode}
</foreach>
<if test="materialName != null and materialName != ''"> and bp.product_desc_zh like concat('%', #{materialName}, '%')</if>
</select>
<insert id="insertQcUserMaterial" parameterType="QcUserMaterial">
insert into qc_user_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userCode != null">user_code,</if>
<if test="userName != null">user_name,</if>
<if test="materialCode != null">material_code,</if>
<if test="materialName != null">material_name,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userCode != null">#{userCode},</if>
<if test="userName != null">#{userName},</if>
<if test="materialCode != null">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateQcUserMaterial" parameterType="QcUserMaterial">
update qc_user_material
<trim prefix="SET" suffixOverrides=",">
<if test="userCode != null">user_code = #{userCode},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="materialCode != null">material_code = #{materialCode},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteQcUserMaterialByUserCode" parameterType="String">
delete from qc_user_material where user_code = #{userCode}
</delete>
<delete id="deleteQcUserMaterialByUserCodes" parameterType="String">
delete from qc_user_material where user_code in
<foreach item="userCode" collection="array" open="(" separator="," close=")">
#{userCode}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save