后台维修代码提交

This commit is contained in:
liuchuan 2023-12-21 20:24:45 +08:00
parent 5564d3d391
commit 04bb0c890f
16 changed files with 142 additions and 138 deletions

View File

@ -185,4 +185,11 @@ public class TmTask implements Serializable {
@ApiModelProperty(value="更新时间") @ApiModelProperty(value="更新时间")
private String updateTimes; private String updateTimes;
public String getBackTime() {
return backTime;
}
public void setBackTime(String backTime) {
this.backTime = backTime;
}
} }

View File

@ -7,6 +7,7 @@ import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo; import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.common.security.utils.SecurityUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -83,5 +84,29 @@ public class MaPartTypeController extends BaseController {
} }
return toAjax(maPartTypeService.deletePaById(paId)); return toAjax(maPartTypeService.deletePaById(paId));
} }
/**
* 根据id获取数据
* @param paId
* @return
*/
@GetMapping("/{paId}")
public AjaxResult getById(@PathVariable("paId") Long paId){
MaPartType bean = maPartTypeService.getById(paId);
return AjaxResult.success(bean);
}
/**
* 根据id修改数据
* @param maPartType
* @return
*/
@PostMapping("/updateById")
public AjaxResult updateById(@RequestBody MaPartType maPartType){
maPartType.setUpdateBy(SecurityUtils.getUsername());
return toAjax(maPartTypeService.updateById(maPartType));
}
} }

View File

@ -39,6 +39,7 @@ public class MaMachineLabel extends BaseEntity
@Excel(name = "数据所属组织") @Excel(name = "数据所属组织")
@ApiModelProperty(value = "数据所属组织") @ApiModelProperty(value = "数据所属组织")
private String companyId; private String companyId;
private int labelNum;
/* *//** 数据所属组织 *//* /* *//** 数据所属组织 *//*

View File

@ -2,6 +2,7 @@ package com.bonus.sgzb.base.domain;
import com.bonus.sgzb.common.core.annotation.Excel; import com.bonus.sgzb.common.core.annotation.Excel;
import com.bonus.sgzb.common.core.web.domain.BaseEntity; import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Date; import java.util.Date;
@ -12,6 +13,7 @@ import java.util.Date;
* @since 2023-11-27 16:44:09 * @since 2023-11-27 16:44:09
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
@Data
public class MaPartType extends BaseEntity { public class MaPartType extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -80,142 +82,6 @@ public class MaPartType extends BaseEntity {
@Excel(name = "数据所属组织") @Excel(name = "数据所属组织")
private String companyId; private String companyId;
public Long getPaId() {
return paId;
}
public void setPaId(Long paId) {
this.paId = paId;
}
public String getPaName() {
return paName;
}
public void setPaName(String paName) {
this.paName = paName;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
public String getUnitId() {
return unitId;
}
public void setUnitId(String unitId) {
this.unitId = unitId;
}
public String getBuyPrice() {
return buyPrice;
}
public void setBuyPrice(String buyPrice) {
this.buyPrice = buyPrice;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getWarnNum() {
return warnNum;
}
public void setWarnNum(String warnNum) {
this.warnNum = warnNum;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
@Override
public String getCreateBy() {
return createBy;
}
@Override
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String getUpdateBy() {
return updateBy;
}
@Override
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
@Override
public Date getUpdateTime() {
return updateTime;
}
@Override
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String getRemark() {
return remark;
}
@Override
public void setRemark(String remark) {
this.remark = remark;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
} }

View File

@ -3,6 +3,7 @@ package com.bonus.sgzb.base.mapper;
import com.bonus.sgzb.base.domain.MaMachineLabel; import com.bonus.sgzb.base.domain.MaMachineLabel;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.Date;
import java.util.List; import java.util.List;
@Mapper @Mapper
public interface MaMachineLabelMapper { public interface MaMachineLabelMapper {
@ -19,4 +20,5 @@ public interface MaMachineLabelMapper {
*/ */
public int insertMaMachineLabel(MaMachineLabel maMachineLabel); public int insertMaMachineLabel(MaMachineLabel maMachineLabel);
int selectLableNumByMonth(Date nowDate);
} }

View File

@ -48,5 +48,9 @@ public interface MaPartTypeMapper {
* @return * @return
*/ */
int deletePaById(Long paId); int deletePaById(Long paId);
MaPartType getById(Long paId);
int updateById(MaPartType maPartType);
} }

View File

@ -54,6 +54,10 @@ public interface IPartTypeService {
* @return * @return
*/ */
int deletePaById(Long paId); int deletePaById(Long paId);
MaPartType getById(Long paId);
int updateById(MaPartType maPartType);
} }

View File

@ -3,9 +3,12 @@ package com.bonus.sgzb.base.service.impl;
import com.bonus.sgzb.base.domain.MaMachineLabel; import com.bonus.sgzb.base.domain.MaMachineLabel;
import com.bonus.sgzb.base.mapper.MaMachineLabelMapper; import com.bonus.sgzb.base.mapper.MaMachineLabelMapper;
import com.bonus.sgzb.base.service.IMaMachineLabelService; import com.bonus.sgzb.base.service.IMaMachineLabelService;
import com.bonus.sgzb.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List; import java.util.List;
@Service("IMaMachineLabelService") @Service("IMaMachineLabelService")
public class MaMachineLabelServiceImpl implements IMaMachineLabelService public class MaMachineLabelServiceImpl implements IMaMachineLabelService
@ -36,7 +39,24 @@ public class MaMachineLabelServiceImpl implements IMaMachineLabelService
@Override @Override
public int insertMaMachineLabel(MaMachineLabel maMachineLabel) public int insertMaMachineLabel(MaMachineLabel maMachineLabel)
{ {
int i;
return maMachineLabelMapper.insertMaMachineLabel(maMachineLabel); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate);
int lableNum = maMachineLabelMapper.selectLableNumByMonth(nowDate) + 1;
for (i = 0;i<maMachineLabel.getLabelNum();i++){
String code="";
if (lableNum>9 && lableNum<100){
code = format + "-00" + lableNum;
}else if (lableNum>99 && lableNum<1000){
code = format + "-0" + lableNum;
}else {
code = format + "-000" + lableNum;
}
lableNum++;
maMachineLabel.setLabelCode(code);
maMachineLabelMapper.insertMaMachineLabel(maMachineLabel);
}
return i;
} }
} }

View File

@ -88,5 +88,15 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
public int deletePaById(Long paId) { public int deletePaById(Long paId) {
return maPartTypeMapper.deletePaById(paId); return maPartTypeMapper.deletePaById(paId);
} }
@Override
public MaPartType getById(Long paId) {
return maPartTypeMapper.getById(paId);
}
@Override
public int updateById(MaPartType maPartType) {
return maPartTypeMapper.updateById(maPartType);
}
} }

View File

@ -21,6 +21,11 @@
from ma_machine_label from ma_machine_label
where is_bind ='0' where is_bind ='0'
</select> </select>
<select id="selectLableNumByMonth" resultType="java.lang.Integer">
select count(*)
from ma_machine_label
where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{nowDate},'%y%m')
</select>
<insert id="insertMaMachineLabel" parameterType="com.bonus.sgzb.base.domain.MaMachineLabel" useGeneratedKeys="true" keyProperty="labelId"> <insert id="insertMaMachineLabel" parameterType="com.bonus.sgzb.base.domain.MaMachineLabel" useGeneratedKeys="true" keyProperty="labelId">
insert into ma_machine_label insert into ma_machine_label
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -29,6 +34,7 @@
<if test="isBind != null">is_bind,</if> <if test="isBind != null">is_bind,</if>
<if test="labelType != null">label_type,</if> <if test="labelType != null">label_type,</if>
<if test="companyId != null">company_id,</if> <if test="companyId != null">company_id,</if>
create_time
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="labelCode != null">#{labelCode},</if> <if test="labelCode != null">#{labelCode},</if>
@ -36,6 +42,7 @@
<if test="isBind != null">#{isBind},</if> <if test="isBind != null">#{isBind},</if>
<if test="labelType != null">#{labelType},</if> <if test="labelType != null">#{labelType},</if>
<if test="companyId != null">#{companyId},</if> <if test="companyId != null">#{companyId},</if>
now()
</trim> </trim>
</insert> </insert>

View File

@ -59,6 +59,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sysdate() sysdate()
) )
</insert> </insert>
<update id="updateById">
update ma_part_type
set pa_name = #{paName},
num = #{num},
unit_id = #{unitId},
buy_price = #{buyPrice},
update_by = #{updateBy},
update_time = now(),
remark = #{remark},
company_id = #{companyId}
where pa_id = #{paId}
</update>
<delete id="deletePaById"> <delete id="deletePaById">
update ma_part_type set del_flag = '2' where pa_id = #{paId} update ma_part_type set del_flag = '2' where pa_id = #{paId}
@ -82,4 +94,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(1) from ma_part_type select count(1) from ma_part_type
where del_flag = '0' and parent_id = #{paId} limit 1 where del_flag = '0' and parent_id = #{paId} limit 1
</select> </select>
<select id="getById" resultType="com.bonus.sgzb.base.domain.MaPartType">
select pa_id, pa_name, parent_id, status, num, unit_id, buy_price, level, warn_num, del_flag, create_by, create_time, remark, company_id
from ma_part_type
where pa_id = #{paId}
</select>
</mapper> </mapper>

View File

@ -100,6 +100,12 @@ public class SelectController {
return service.getAccessoryTree(dto); return service.getAccessoryTree(dto);
} }
@ApiOperation(value = "配件所属上级树")
@PostMapping("getPartTree")
public AjaxResult getPartTree(@RequestBody SelectDto dto){
return service.getPartTree(dto);
}
@ApiOperation(value = "货架") @ApiOperation(value = "货架")
@PostMapping("getGoodsShelvesCbx") @PostMapping("getGoodsShelvesCbx")
public AjaxResult getGoodsShelvesCbx(@RequestBody SelectDto dto){ public AjaxResult getGoodsShelvesCbx(@RequestBody SelectDto dto){

View File

@ -166,4 +166,6 @@ public interface SelectMapper {
* @date 2023/12/21 10:53 * @date 2023/12/21 10:53
*/ */
List<AgreementVo> getAgreementInfoById(SelectDto dto); List<AgreementVo> getAgreementInfoById(SelectDto dto);
List<TreeNode> getPartTree(SelectDto dto);
} }

View File

@ -152,4 +152,6 @@ public interface SelectService {
* @date 2023/12/21 10:47 * @date 2023/12/21 10:47
*/ */
AjaxResult getAgreementInfoById(SelectDto dto); AjaxResult getAgreementInfoById(SelectDto dto);
AjaxResult getPartTree(SelectDto dto);
} }

View File

@ -192,6 +192,24 @@ public class SelectServiceImpl implements SelectService {
return AjaxResult.success(groupList); return AjaxResult.success(groupList);
} }
@Override
public AjaxResult getPartTree(SelectDto dto) {
List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>();
try {
list = mapper.getPartTree(dto);
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TreeBuild treeBuild = new TreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
} catch (Exception e) {
log.error("配件所属上级树-查询失败", e);
}
return AjaxResult.success(groupList);
}
@Override @Override
public AjaxResult getGoodsShelvesCbx(SelectDto dto) { public AjaxResult getGoodsShelvesCbx(SelectDto dto) {
List<TreeNode> groupList = new ArrayList<>(); List<TreeNode> groupList = new ArrayList<>();
@ -250,4 +268,6 @@ public class SelectServiceImpl implements SelectService {
} }
return AjaxResult.success(vo); return AjaxResult.success(vo);
} }
} }

View File

@ -143,6 +143,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE del_flag = '0' WHERE del_flag = '0'
ORDER BY create_time ORDER BY create_time
</select> </select>
<select id="getPartTree" resultType="com.bonus.sgzb.system.domain.TreeNode">
SELECT pa_id AS id,
pa_name AS label,
parent_id AS parentId,
level
FROM ma_part_type
WHERE del_flag = '0' and level != '4'
ORDER BY create_time
</select>
<!--货架--> <!--货架-->
<select id="getGoodsShelvesCbx" resultType="com.bonus.sgzb.system.domain.TreeNode"> <select id="getGoodsShelvesCbx" resultType="com.bonus.sgzb.system.domain.TreeNode">
SELECT house_id AS id, SELECT house_id AS id,
@ -183,4 +193,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM bm_agreement_info FROM bm_agreement_info
WHERE unit_id = #{unitId} AND project_id = #{projectId} AND status = '1' WHERE unit_id = #{unitId} AND project_id = #{projectId} AND status = '1'
</select> </select>
</mapper> </mapper>