Compare commits

..

2 Commits

Author SHA1 Message Date
liang.chao 4b1645e96e Merge remote-tracking branch 'origin/master' 2024-09-23 16:35:39 +08:00
liang.chao 88f1e9f954 重庆需求变更代码提交 2024-09-23 16:35:29 +08:00
7 changed files with 92 additions and 29 deletions

View File

@ -1,10 +1,13 @@
package com.bonus.sgzb.base.controller;
import cn.hutool.core.convert.Convert;
import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.base.domain.MaKeeperUser;
import com.bonus.sgzb.base.domain.vo.TreeSelect;
import com.bonus.sgzb.base.mapper.MaTypeMapper;
import com.bonus.sgzb.base.service.ITypeService;
import com.bonus.sgzb.common.core.utils.ListPagingUtil;
import com.bonus.sgzb.common.core.utils.ServletUtils;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.log.annotation.Log;
@ -15,8 +18,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_NUM;
import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_SIZE;
/**
* 工机具类型管理控制层
*/
@ -34,6 +41,7 @@ public class MaTypeController extends BaseController {
/**
* 根据类型名称查询类型
*
* @return 结果
*/
@ApiOperation(value = "根据类型名称查询类型")
@ -44,9 +52,9 @@ public class MaTypeController extends BaseController {
}
/**
* 工机具类型下拉树
*
* @return 结果
*/
@ApiOperation(value = "工机具类型下拉树")
@ -65,6 +73,7 @@ public class MaTypeController extends BaseController {
/**
* 根据左列表类型id查询右表格
*
* @param typeId
* @return
*/
@ -78,12 +87,15 @@ public class MaTypeController extends BaseController {
/**
* 获取规格层级为3的设备列表
*
* @return 结果
*/
@ApiOperation(value = "获取规格层级的设备列表")
@GetMapping("/selectMaTypeListByLevelIndex")
public AjaxResult selectMaTypeListByLevelIndex(@RequestParam(value = "level", required = false) Integer level, @RequestParam(value = "type") Integer type, @RequestParam(value = "parentId", required = false) Integer parentId, @RequestParam(value = "keyword", required = false) String keyword) {
if (type == null) { return AjaxResult.error("参数错误,类型不能为空"); }
if (type == null) {
return AjaxResult.error("参数错误,类型不能为空");
}
if (type == 0) {
// 查询全部机具类型
if (level == 0 || level == 1) {
@ -183,15 +195,21 @@ public class MaTypeController extends BaseController {
/**
* 根据左列表类型id查询右表格
*
* @param typeId
* @return
*/
@ApiOperation(value = "根据左列表类型id查询右表格")
@GetMapping("/getListByMaType")
public AjaxResult getListByMaType(@RequestParam(required = false) Long typeId,
@RequestParam(required = false) String typeName){
List<MaType> listByMaType = iTypeService.getListByParentId(typeId,typeName);
return success(listByMaType);
public AjaxResult getListByMaType(Long typeId, @RequestParam(required = false) String typeName, Integer level) {
List<Integer> parentIds = iTypeService.selectParentId(typeId, level);
List<MaType> listByMaType = new ArrayList<>();
for (Integer parentId : parentIds) {
listByMaType.addAll(iTypeService.getListByParentId(parentId.longValue(), typeName));
}
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, listByMaType));
}
/**
@ -224,8 +242,7 @@ public class MaTypeController extends BaseController {
*/
@ApiOperation(value = "获取机具类型管理ma_type详细信息")
@GetMapping(value = "/{typeId}")
public AjaxResult getInfo(@PathVariable("typeId") Long typeId)
{
public AjaxResult getInfo(@PathVariable("typeId") Long typeId) {
return success(iTypeService.selectMaTypeByTypeId(typeId));
}
@ -235,8 +252,7 @@ public class MaTypeController extends BaseController {
@ApiOperation(value = "新增机具类型管理ma_type")
@Log(title = "机具类型管理ma_type", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MaType maType)
{
public AjaxResult add(@RequestBody MaType maType) {
int result = iTypeService.insertMaType(maType);
if (result > 0) {
return success(toAjax(iTypeService.insertMaType(maType)));
@ -251,8 +267,7 @@ public class MaTypeController extends BaseController {
@ApiOperation(value = "修改机具类型管理ma_type")
@Log(title = "机具类型管理ma_type", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MaType maType)
{
public AjaxResult edit(@RequestBody MaType maType) {
return toAjax(iTypeService.updateMaType(maType));
}

View File

@ -89,4 +89,5 @@ public interface MaTypeMapper {
List<MaTypeKeeper> selectMaTypeByUserId(Long userId);
List<Integer> selectParentId( @Param("typeId")Long typeId, @Param("level")Integer level);
}

View File

@ -67,6 +67,7 @@ public interface ITypeService {
public List<TreeSelect> buildDeptTreeSelect(List<MaType> maTypeList);
List<MaType> getListByParentId(Long typeId, String typeName);
List<Integer> selectParentId(Long typeId, Integer level);
List<MaType> getEquipmentType(Long typeId, String typeName);

View File

@ -58,7 +58,12 @@ public class MaTypeServiceImpl implements ITypeService {
return 0;
}
MaType maType1 = maTypeMapper.selectMaTypeByTypeId(parentId);
String level = maType1.getLevel();
String level;
if (maType1 == null) {
level = "0";
} else {
level = maType1.getLevel();
}
maType.setLevel(String.valueOf(Integer.parseInt(level) + 1));
maType.setCreateTime(DateUtils.getNowDate());
System.out.println(maType);
@ -328,6 +333,11 @@ public class MaTypeServiceImpl implements ITypeService {
return maTypeMapper.getListByParentId(typeId, typeName);
}
@Override
public List<Integer> selectParentId(Long typeId, Integer level) {
return maTypeMapper.selectParentId(typeId,level);
}
/**
* 查询工器具类型四级组织树
*

View File

@ -120,6 +120,17 @@ public class PurchaseCheckInfo extends BaseEntity
@ApiModelProperty(value="结束时间")
private String endTime;
public String getPurchaseNumber() {
return purchaseNumber;
}
public void setPurchaseNumber(String purchaseNumber) {
this.purchaseNumber = purchaseNumber;
}
@ApiModelProperty(value="线下采购单编号")
private String purchaseNumber;
public String getKeyWord() {
return keyWord;
}

View File

@ -426,6 +426,28 @@
select * from ma_type_keeper where user_id = #{userId}
</select>
<select id="selectParentId" resultType="java.lang.Integer">
SELECT DISTINCT
mt2.type_id
FROM
ma_type mt
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
WHERE 1=1
<if test="level == 1">
and mt4.type_id = #{typeId}
</if>
<if test="level == 2">
and mt3.type_id = #{typeId}
</if>
<if test="level == 3">
and mt2.type_id = #{typeId}
</if>
<if test="level == 0">
and mt.level = 4
</if>
</select>
<update id="updateTypeNum">
update ma_type set num = IFNULL( num, 0 ) + 1 where type_id = #{typeId}

View File

@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPurchaseCheckInfoList" parameterType="com.bonus.sgzb.material.domain.PurchaseCheckInfo" resultMap="PurchaseCheckInfoResult">
select pci.id,pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by, pci.create_time,
pci.update_by,
pci.update_by,pci.purchase_number,
pci.update_time, pci.remark, pci.company_id ,dict.id purchasingId,dict.name
purchasingStatus,tk.code,su.nick_name
purchaserName,tk.task_status taskStatus
@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPurchaseCheckInfoByTaskId" parameterType="Long" resultMap="PurchaseCheckInfoResult">
select pci.id,pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by, pci.create_time,
pci.update_by, pci.update_time, pci.remark, pci.company_id, tk.code
pci.update_by, pci.update_time, pci.remark, pci.company_id, tk.code,pci.purchase_number
from purchase_check_info pci
left join tm_task tk on pci.task_id = tk.task_id
where pci.task_id = #{taskId}
@ -79,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="companyId != null">company_id,</if>
<if test="purchaseNumber != null">purchase_number,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskId != null">#{taskId},</if>
@ -91,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="companyId != null">#{companyId},</if>
<if test="purchaseNumber != null">#{purchaseNumber},</if>
</trim>
</insert>
@ -106,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="companyId != null">company_id = #{companyId},</if>
<if test="purchaseNumber != null and purchaseNumber != ''" >purchase_number = #{purchaseNumber},</if>
</trim>
where task_id = #{taskId}
</update>