Merge remote-tracking branch 'origin/master'

highway
chj 1 year ago
commit 0e36fc75a6

@ -33,6 +33,17 @@ public class MesPrepareDetailController extends BaseController {
@Autowired
private IMesPrepareDetailService mesPrepareDetailService;
/**
* code
* @return
*/
@RequiresPermissions("mes:prepareDetail:export")
@Log(title = "mes备料打印", businessType = BusinessType.EXPORT)
@GetMapping("/printPrepareByCode/{workorderCode}")
public AjaxResult printPrepareByCode(@PathVariable("workorderCode") String workorderCode) {
return mesPrepareDetailService.printPrepareByCode(workorderCode);
}
/**
* mes
*/

@ -0,0 +1,32 @@
package com.op.mes.domain.vo;
import com.op.mes.domain.MesPrepare;
import com.op.mes.domain.MesPrepareDetail;
import java.util.Date;
import java.util.List;
// 打印备料单返回实体
public class PrintPrepareVo {
private MesPrepare mesPrepare;
private List<MesPrepareDetail> mesPrepareDetailList;
public PrintPrepareVo() {
}
public MesPrepare getMesPrepare() {
return mesPrepare;
}
public void setMesPrepare(MesPrepare mesPrepare) {
this.mesPrepare = mesPrepare;
}
public List<MesPrepareDetail> getMesPrepareDetailList() {
return mesPrepareDetailList;
}
public void setMesPrepareDetailList(List<MesPrepareDetail> mesPrepareDetailList) {
this.mesPrepareDetailList = mesPrepareDetailList;
}
}

@ -2,6 +2,7 @@ package com.op.mes.mapper;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.mes.domain.MesPrepareDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -63,4 +64,11 @@ public interface MesPrepareDetailMapper {
public int deleteMesPrepareDetailByRecordIds(String[] recordIds);
public void insertMesPrepareDetails(@Param("list") List<MesPrepareDetail> details);
/**
* idlist
* @param prepareId
* @return
*/
List<MesPrepareDetail> selectPrintPrepareDetailList(String prepareId);
}

@ -2,6 +2,7 @@ package com.op.mes.mapper;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.mes.domain.MesPrepare;
import org.apache.ibatis.annotations.Mapper;
@ -62,4 +63,11 @@ public interface MesPrepareMapper {
public int deleteMesPrepareByPrepareIds(String[] prepareIds);
public List<MesPrepare> getParentWorkOrderT1(MesPrepare qo);
/**
* code
* @param workorderCode
* @return
*/
MesPrepare selectMesPrepareByCode(String workorderCode);
}

@ -1,6 +1,8 @@
package com.op.mes.service;
import java.util.List;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.MesPrepareDetail;
/**
@ -57,4 +59,10 @@ public interface IMesPrepareDetailService {
* @return
*/
public int deleteMesPrepareDetailByRecordId(String recordId);
/**
* code
* @return
*/
AjaxResult printPrepareByCode(String workorderCode);
}

@ -1,7 +1,13 @@
package com.op.mes.service.impl;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.MesPrepare;
import com.op.mes.domain.vo.PrintPrepareVo;
import com.op.mes.mapper.MesPrepareMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.MesPrepareDetailMapper;
@ -18,6 +24,8 @@ import com.op.mes.service.IMesPrepareDetailService;
public class MesPrepareDetailServiceImpl implements IMesPrepareDetailService {
@Autowired
private MesPrepareDetailMapper mesPrepareDetailMapper;
@Autowired
private MesPrepareMapper mesPrepareMapper;
/**
* mes
@ -86,4 +94,19 @@ public class MesPrepareDetailServiceImpl implements IMesPrepareDetailService {
public int deleteMesPrepareDetailByRecordId(String recordId) {
return mesPrepareDetailMapper.deleteMesPrepareDetailByRecordId(recordId);
}
/**
* code
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult printPrepareByCode(String workorderCode) {
MesPrepare mesPrepare = mesPrepareMapper.selectMesPrepareByCode(workorderCode);
List<MesPrepareDetail> mesPrepareDetailList = mesPrepareDetailMapper.selectPrintPrepareDetailList(mesPrepare.getPrepareId());
PrintPrepareVo printPrepareVo = new PrintPrepareVo();
printPrepareVo.setMesPrepare(mesPrepare);
printPrepareVo.setMesPrepareDetailList(mesPrepareDetailList);
return AjaxResult.success(printPrepareVo);
}
}

@ -8,8 +8,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="recordId" column="record_id" />
<result property="prepareId" column="prepare_id" />
<result property="materialCode" column="material_code" />
<result property="materailName" column="materail_name" />
<result property="materailSpc" column="materail_spc" />
<result property="materailName" column="material_name" />
<result property="materailSpc" column="material_spc" />
<result property="unit" column="unit" />
<result property="quantity" column="quantity" />
<result property="productDate" column="product_date" />
@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="prodType" column="prod_type" />
<result property="factoryCode" column="factory_code" />
<result property="fundQuanlity" column="fund_quanlity" />
</resultMap>
<sql id="selectMesPrepareDetailVo">
@ -61,6 +62,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where record_id = #{recordId}
</select>
<select id="selectPrintPrepareDetailList" parameterType="String" resultMap="MesPrepareDetailResult">
select record_id, prepare_id, material_code,material_name, unit,
quantity, status, remark, attr1, attr2, attr3, attr4,
create_by, create_time, update_by, update_time, prod_type, factory_code,fund_quanlity
from mes_prepare_detail
where prepare_id = #{prepareId}
</select>
<insert id="insertMesPrepareDetail" parameterType="MesPrepareDetail">
insert into mes_prepare_detail
<trim prefix="(" suffix=")" suffixOverrides=",">

@ -110,7 +110,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and CONVERT(varchar(100), product_date, 23) = #{dayStr}
</select>
<insert id="insertMesPrepare" parameterType="MesPrepare">
<select id="selectMesPrepareByCode" parameterType="String" resultMap="MesPrepareResult">
select prepare_id, workorder_code, workorder_name, parent_order, order_id, order_code, product_id, product_code, prod_type, product_name, product_spc, wet_detail_plan_id, product_date, shift_id, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, unit from mes_prepare
where workorder_code = #{workorderCode}
</select>
<insert id="insertMesPrepare" parameterType="MesPrepare">
insert into mes_prepare
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="prepareId != null">prepare_id,</if>

@ -132,6 +132,17 @@ public class ProOrder extends TreeEntity {
@Excel(name = "更新日期", width = 20, dateFormat = "yyyy-MM-dd")
private Date updateTime;
// 车数
private Integer carNum;
public Integer getCarNum() {
return carNum;
}
public void setCarNum(Integer carNum) {
this.carNum = carNum;
}
@Override
public Date getCreateTime() {
return createTime;
@ -324,6 +335,7 @@ public class ProOrder extends TreeEntity {
.append("prodSpc", getProdSpc())
.append("planDateStart",getPlanDateStart())
.append("planDateEnd",getPlanDateEnd())
.append("carNum",getCarNum())
.toString();
}
}

@ -148,6 +148,17 @@ public class ProOrderWorkorder extends TreeEntity {
/** 班次名称(数据库无该字段,需自行查询) */
private String shiftDesc;
// 车数
private Integer carNum;
public Integer getCarNum() {
return carNum;
}
public void setCarNum(Integer carNum) {
this.carNum = carNum;
}
// 料罐id湿料计划模块使用
private Integer bucketId;
@ -512,6 +523,7 @@ public class ProOrderWorkorder extends TreeEntity {
.append("bucketName",getBucketName())
.append("routeName",getRouteName())
.append("prodLineName",getProdLineName())
.append("carNum",getCarNum())
.toString();
}
}

@ -63,6 +63,16 @@ public class ProOrderDTO {
private String planFactoryCode;
private Integer carNum;
public Integer getCarNum() {
return carNum;
}
public void setCarNum(Integer carNum) {
this.carNum = carNum;
}
public String getPlanFactoryCode() {
return planFactoryCode;
}

@ -154,6 +154,12 @@ public class ProOrderServiceImpl implements IProOrderService {
workOrder.setWorkorderCode(proOrder.getOrderCode() + "-" + endCode);
// 3.设置父工单
workOrder.setParentOrder(parentOrder.toString());
// 工单对应车数-白坯订单操作
if (proOrder.getProdType().equals("white")) {
int everyNum = (int) Math.ceil(proOrder.getQuantity() / proOrder.getCarNum());
int carNum = (int) Math.ceil(splitOrderDTO.getSplitNum() / everyNum);
workOrder.setCarNum(carNum);
}
// 将工单信息更新至数据库
proOrderWorkorderMapper.insertProOrderWorkorder(workOrder);
// 生成批次表信息并更新至数据库

@ -525,6 +525,13 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
if (splitOrderDTO.getRouteCode() != null){
proOrderWorkorder.setRouteCode(splitOrderDTO.getRouteCode());
}
// 白坯工单返修-车数
if (proOrderWorkorder.getProdType().equals("white")) {
int everyNum = (int) Math.ceil(proOrder.getQuantity() / proOrder.getCarNum());
int carNum = (int) Math.ceil(splitOrderDTO.getSplitNum() / everyNum);
proOrderWorkorder.setCarNum(carNum);
}
proOrderWorkorderMapper.updateProOrderWorkorder(proOrderWorkorder);
// System.out.println("这里是workorderCode------------》"+proOrderWorkorder.getWorkorderCode());

@ -29,13 +29,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="prodType" column="prod_type" />
<result property="prodSpc" column="prod_spc" />
<result property="carNum" column="car_num" />
</resultMap>
<sql id="selectProOrderVo">
select id, plan_factory_code, order_type, order_code, prod_code, prod_desc, quantity, quantity_split,
unit, worker_order, plan_pro_date, plan_complete, atrr1, atrr2, atrr3,
status, parent_order, create_by, create_time, update_by, update_time, prod_type,
factory_code, prod_spc
factory_code, prod_spc ,car_num
from pro_order
</sql>
@ -45,8 +46,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="planFactoryCode != null and planFactoryCode != ''"> and plan_factory_code = #{planFactoryCode}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
<if test="orderCode != null and orderCode != ''"> and order_code = #{orderCode}</if>
<if test="prodCode != null and prodCode != ''"> and prod_code = #{prodCode}</if>
<if test="orderCode != null and orderCode != ''"> and order_code like concat('%', #{orderCode}, '%')</if>
<if test="prodCode != null and prodCode != ''"> and prod_code like concat('%', #{prodCode}, '%')</if>
<if test="prodDesc != null and prodDesc != ''"> and prod_desc like concat('%', #{prodDesc}, '%')</if>
<if test="quantity != null "> and quantity = #{quantity}</if>
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
@ -197,6 +198,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="prodType != null">prod_type,</if>
<if test="prodSpc != null">prod_spc,</if>
<if test="carNum != null">car_num,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -223,6 +225,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if>
<if test="prodType != null">#{prodType},</if>
<if test="prodSpc != null">#{prodSpc},</if>
<if test="carNum != null">#{carNum},</if>
</trim>
</insert>

@ -36,13 +36,14 @@
<result property="prodType" column="prod_type" />
<result property="factoryCode" column="factory_code" />
<result property="endFlag" column="end_flag" />
<result property="carNum" column="car_num" />
</resultMap>
<sql id="selectProOrderWorkorderVo">
select workorder_id, workorder_code, workorder_name, order_id, order_code, product_id, product_code, product_name,
product_spc, unit, quantity_produced, quantity_split, route_code, prod_line_code, product_date,
shift_id, parent_order, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time,
update_by, update_time, prod_type, factory_code , end_flag
update_by, update_time, prod_type, factory_code , end_flag , car_num
from pro_order_workorder
</sql>
@ -184,6 +185,7 @@
<if test="prodType != null">prod_type,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="endFlag != null">end_flag,</if>
<if test="carNum != null">car_num,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workorderId != null">#{workorderId},</if>
@ -217,6 +219,7 @@
<if test="prodType != null">#{prodType},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="endFlag != null">#{endFlag},</if>
<if test="carNum != null">#{carNum},</if>
</trim>
</insert>
<insert id="createPrepare">
@ -368,6 +371,7 @@
<if test="prodType != null">prod_type = #{prodType},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="endFlag != null">end_flag = #{endFlag},</if>
<if test="carNum != null">car_num = #{carNum},</if>
</trim>
where workorder_id = #{workorderId}
</update>

@ -2,6 +2,8 @@ package com.op.wms.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.wms.domain.BaseTeamUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

@ -0,0 +1,109 @@
package com.op.wms.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.wms.domain.BaseTeamUser;
import com.op.wms.service.IBaseTeamUserService;
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-08-29
*/
@RestController
@RequestMapping("/teamUser")
public class BaseTeamUserController extends BaseController {
@Autowired
private IBaseTeamUserService baseTeamUserService;
/**
*
*/
@RequiresPermissions("wms:teamUser:list")
@GetMapping("/list")
public TableDataInfo list(BaseTeamUser baseTeamUser) {
startPage();
List<BaseTeamUser> list = baseTeamUserService.selectBaseTeamUserList(baseTeamUser);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("wms:teamUser:listTeamMembers")
@GetMapping("/listTeamMembers")
public TableDataInfo listTeamMembers(BaseTeamUser baseTeamUser) {
startPage();
List<BaseTeamUser> list = baseTeamUserService.selectTeamMembers(baseTeamUser);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("wms:teamUser:export")
@Log(title = "班组人员", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BaseTeamUser baseTeamUser) {
List<BaseTeamUser> list = baseTeamUserService.selectBaseTeamUserList(baseTeamUser);
ExcelUtil<BaseTeamUser> util = new ExcelUtil<BaseTeamUser>(BaseTeamUser.class);
util.exportExcel(response, list, "班组人员数据");
}
/**
*
*/
@RequiresPermissions("wms:teamUser:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(baseTeamUserService.selectBaseTeamUserById(id));
}
/**
*
*/
@RequiresPermissions("wms:teamUser:add")
@Log(title = "班组人员", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseTeamUser baseTeamUser) {
return toAjax(baseTeamUserService.insertBaseTeamUser(baseTeamUser));
}
/**
*
*/
@RequiresPermissions("wms:teamUser:edit")
@Log(title = "班组人员", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseTeamUser baseTeamUser) {
return toAjax(baseTeamUserService.updateBaseTeamUser(baseTeamUser));
}
/**
*
*/
@RequiresPermissions("wms:teamUser:remove")
@Log(title = "班组人员", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(baseTeamUserService.deleteBaseTeamUserByIds(ids));
}
}

@ -1,6 +1,8 @@
package com.op.wms.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -113,6 +115,26 @@ public class BaseTeamT extends BaseEntity {
@Excel(name = "班组类型")
private String teamType;
private List<String> rightData;
public void setRightData(List<String> rightData) {
this.rightData = rightData;
}
public List<String> getRightData() {
return rightData;
}
private List<BaseTeamUser> selectedData;
public void setSelectedData(List<BaseTeamUser> selectedData) {
this.selectedData = selectedData;
}
public List<BaseTeamUser> getSelectedData() {
return selectedData;
}
public void setTeamType(String teamType) {
this.teamType = teamType;
}

@ -0,0 +1,86 @@
package com.op.wms.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;
/**
* base_team_user
*
* @author Open Platform
* @date 2023-08-29
*/
public class BaseTeamUser extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键 */
private String id;
/** 班组id */
@Excel(name = "班组id")
private String teamId;
/** 班组编码 */
@Excel(name = "班组编码")
private String teamCode;
/** 人员id */
@Excel(name = "人员id")
private String userId;
/** 人员名字 */
@Excel(name = "人员名字")
private String userName;
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setTeamId(String teamId) {
this.teamId = teamId;
}
public String getTeamId() {
return teamId;
}
public void setTeamCode(String teamCode) {
this.teamCode = teamCode;
}
public String getTeamCode() {
return teamCode;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserId() {
return userId;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserName() {
return userName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("teamId", getTeamId())
.append("teamCode", getTeamCode())
.append("userId", getUserId())
.append("userName", getUserName())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -2,7 +2,9 @@ package com.op.wms.mapper;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.wms.domain.BaseTeamT;
import com.op.wms.domain.BaseTeamUser;
/**
* Mapper
@ -41,6 +43,7 @@ public interface BaseTeamTMapper {
* @param baseTeamT
* @return
*/
@DS("#header.poolName")
public int updateBaseTeamT(BaseTeamT baseTeamT);
/**

@ -0,0 +1,71 @@
package com.op.wms.mapper;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.wms.domain.BaseTeamUser;
/**
* Mapper
*
* @author Open Platform
* @date 2023-08-29
*/
public interface BaseTeamUserMapper {
/**
*
*
* @param id
* @return
*/
public BaseTeamUser selectBaseTeamUserById(String id);
/**
*
*
* @param baseTeamUser
* @return
*/
public List<BaseTeamUser> selectBaseTeamUserList(BaseTeamUser baseTeamUser);
/**
*
*
* @param baseTeamUser
* @return
*/
public int insertBaseTeamUser(BaseTeamUser baseTeamUser);
/**
*
*
* @param baseTeamUser
* @return
*/
public int updateBaseTeamUser(BaseTeamUser baseTeamUser);
/**
*
*
* @param id
* @return
*/
public int deleteBaseTeamUserById(String id);
/**
*
*
* @param ids
* @return
*/
public int deleteBaseTeamUserByIds(String[] ids);
//查询人员
public List<BaseTeamUser> selectTeamMembers(BaseTeamUser baseTeamUser);
//查询人员对应名字
public List<String> selectTeamMembersIds(BaseTeamUser baseTeamUser);
//查询人员ID
public String selectId(BaseTeamUser baseTeamUser);
}

@ -2,6 +2,7 @@ package com.op.wms.service;
import java.util.List;
import com.op.wms.domain.BaseTeamT;
import com.op.wms.domain.BaseTeamUser;
/**
* Service

@ -0,0 +1,62 @@
package com.op.wms.service;
import java.util.List;
import com.op.wms.domain.BaseTeamUser;
/**
* Service
*
* @author Open Platform
* @date 2023-08-29
*/
public interface IBaseTeamUserService {
/**
*
*
* @param id
* @return
*/
public BaseTeamUser selectBaseTeamUserById(String id);
/**
*
*
* @param baseTeamUser
* @return
*/
public List<BaseTeamUser> selectBaseTeamUserList(BaseTeamUser baseTeamUser);
/**
*
*
* @param baseTeamUser
* @return
*/
public int insertBaseTeamUser(BaseTeamUser baseTeamUser);
/**
*
*
* @param baseTeamUser
* @return
*/
public int updateBaseTeamUser(BaseTeamUser baseTeamUser);
/**
*
*
* @param ids
* @return
*/
public int deleteBaseTeamUserByIds(String[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteBaseTeamUserById(String id);
public List<BaseTeamUser> selectTeamMembers(BaseTeamUser baseTeamUser);
}

@ -1,10 +1,14 @@
package com.op.wms.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.wms.domain.BaseTeamUser;
import com.op.wms.mapper.BaseTeamUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.wms.mapper.BaseTeamTMapper;
@ -22,6 +26,9 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService {
@Autowired
private BaseTeamTMapper baseTeamTMapper;
@Autowired
private BaseTeamUserMapper baseTeamUserMapper;
/**
*
*
@ -31,7 +38,12 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService {
@Override
@DS("#header.poolName")
public BaseTeamT selectBaseTeamTByTeamId(String teamId) {
return baseTeamTMapper.selectBaseTeamTByTeamId(teamId);
BaseTeamUser baseTeamUser = new BaseTeamUser();
baseTeamUser.setTeamId(teamId);
List<BaseTeamUser> baseTeamUser1 = baseTeamUserMapper.selectBaseTeamUserList(baseTeamUser);
BaseTeamT baseTeamT = baseTeamTMapper.selectBaseTeamTByTeamId(teamId);
baseTeamT.setSelectedData(baseTeamUser1);
return baseTeamT;
}
/**
@ -71,6 +83,30 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService {
public int updateBaseTeamT(BaseTeamT baseTeamT) {
baseTeamT.setLastUpdateDate(DateUtils.getNowDate());
baseTeamT.setLastUpdateBy(SecurityUtils.getUsername());
for(int i = 0;i<baseTeamT.getRightData().size();i++){
BaseTeamUser baseTeamUser = new BaseTeamUser();
baseTeamUser.setTeamId(baseTeamT.getTeamId());
baseTeamUser.setTeamCode(baseTeamT.getTeamCode());
List<String> list = new ArrayList<>();
list = baseTeamT.getRightData();
String userId = list.get(i);
baseTeamUser.setUserId(userId);
BaseTeamUser baseTeamUser1 = new BaseTeamUser();
List<String> members = baseTeamUserMapper.selectTeamMembersIds(baseTeamUser1);
boolean bool = members.contains(userId);
if(bool == true){
//倒查id
String id = baseTeamUserMapper.selectId(baseTeamUser);
baseTeamUser.setUpdateTime(DateUtils.getNowDate());
baseTeamUser.setUpdateBy(SecurityUtils.getUsername());
baseTeamUserMapper.updateBaseTeamUser(baseTeamUser);
}else{
baseTeamUser.setCreateBy(SecurityUtils.getUsername());
baseTeamUser.setCreateTime(DateUtils.getNowDate());
baseTeamUser.setId(IdUtils.fastSimpleUUID());
baseTeamUserMapper.insertBaseTeamUser(baseTeamUser);
}
}
return baseTeamTMapper.updateBaseTeamT(baseTeamT);
}

@ -0,0 +1,103 @@
package com.op.wms.service.impl;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.wms.mapper.BaseTeamUserMapper;
import com.op.wms.domain.BaseTeamUser;
import com.op.wms.service.IBaseTeamUserService;
/**
* Service
*
* @author Open Platform
* @date 2023-08-29
*/
@Service
public class BaseTeamUserServiceImpl implements IBaseTeamUserService {
@Autowired
private BaseTeamUserMapper baseTeamUserMapper;
/**
*
*
* @param id
* @return
*/
@Override
public BaseTeamUser selectBaseTeamUserById(String id) {
return baseTeamUserMapper.selectBaseTeamUserById(id);
}
/**
*
*
* @param baseTeamUser
* @return
*/
@Override
public List<BaseTeamUser> selectBaseTeamUserList(BaseTeamUser baseTeamUser) {
return baseTeamUserMapper.selectBaseTeamUserList(baseTeamUser);
}
/**
*
*
* @param baseTeamUser
* @return
*/
@Override
public int insertBaseTeamUser(BaseTeamUser baseTeamUser) {
baseTeamUser.setCreateTime(DateUtils.getNowDate());
return baseTeamUserMapper.insertBaseTeamUser(baseTeamUser);
}
/**
*
*
* @param baseTeamUser
* @return
*/
@Override
public int updateBaseTeamUser(BaseTeamUser baseTeamUser) {
baseTeamUser.setUpdateTime(DateUtils.getNowDate());
return baseTeamUserMapper.updateBaseTeamUser(baseTeamUser);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteBaseTeamUserByIds(String[] ids) {
return baseTeamUserMapper.deleteBaseTeamUserByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteBaseTeamUserById(String id) {
return baseTeamUserMapper.deleteBaseTeamUserById(id);
}
/**
*
*
* @param baseTeamUser
* @return
*/
@Override
@DS("#master")
public List<BaseTeamUser> selectTeamMembers(BaseTeamUser baseTeamUser){
return baseTeamUserMapper.selectTeamMembers(baseTeamUser);
}
}

@ -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.wms.mapper.BaseTeamUserMapper">
<resultMap type="BaseTeamUser" id="BaseTeamUserResult">
<result property="id" column="id" />
<result property="teamId" column="team_id" />
<result property="teamCode" column="team_code" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<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="selectBaseTeamUserVo">
select id, team_id, team_code, user_id, user_name, create_by, create_time, update_by, update_time from base_team_user
</sql>
<select id="selectBaseTeamUserList" parameterType="BaseTeamUser" resultMap="BaseTeamUserResult">
<include refid="selectBaseTeamUserVo"/>
<where>
<if test="teamId != null and teamId != ''"> and team_id = #{teamId}</if>
<if test="teamCode != null and teamCode != ''"> and team_code = #{teamCode}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
</where>
</select>
<select id="selectBaseTeamUserById" parameterType="String" resultMap="BaseTeamUserResult">
<include refid="selectBaseTeamUserVo"/>
where id = #{id}
</select>
<insert id="insertBaseTeamUser" parameterType="BaseTeamUser">
insert into base_team_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="teamId != null and teamId != ''">team_id,</if>
<if test="teamCode != null">team_code,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="teamId != null and teamId != ''">#{teamId},</if>
<if test="teamCode != null">#{teamCode},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</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>
</trim>
</insert>
<update id="updateBaseTeamUser" parameterType="BaseTeamUser">
update base_team_user
<trim prefix="SET" suffixOverrides=",">
<if test="teamId != null and teamId != ''">team_id = #{teamId},</if>
<if test="teamCode != null">team_code = #{teamCode},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</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>
</trim>
where id = #{id}
</update>
<delete id="deleteBaseTeamUserById" parameterType="String">
delete from base_team_user where id = #{id}
</delete>
<delete id="deleteBaseTeamUserByIds" parameterType="String">
delete from base_team_user where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectTeamMembers" parameterType="BaseTeamUser" resultMap="BaseTeamUserResult">
select user_id,user_name
from sys_user
</select>
<select id="selectTeamMembersNameById" parameterType="BaseTeamUser" resultType="java.lang.String">
select user_name
from sys_user su
where su.id = #{id}
</select>
<select id="selectTeamMembersIds" parameterType="BaseTeamUser" resultType="java.lang.String">
select user_id
from base_team_user
</select>
<select id="selectId" parameterType="BaseTeamUser" resultType="java.lang.String">
select id
from base_team_user
where user_id = #{userId}
and team_id = #{teamId}
</select>
</mapper>
Loading…
Cancel
Save