Compare commits

..

No commits in common. "4b1645e96e3b8c8b825d72f8720987b943a10549" and "322ae3d804bad0565e40263bb4f6f99fc471ea4e" have entirely different histories.

7 changed files with 29 additions and 92 deletions

View File

@ -1,13 +1,10 @@
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;
@ -18,12 +15,8 @@ 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;
/**
* 工机具类型管理控制层
*/
@ -41,7 +34,6 @@ public class MaTypeController extends BaseController {
/**
* 根据类型名称查询类型
*
* @return 结果
*/
@ApiOperation(value = "根据类型名称查询类型")
@ -52,9 +44,9 @@ public class MaTypeController extends BaseController {
}
/**
* 工机具类型下拉树
*
* @return 结果
*/
@ApiOperation(value = "工机具类型下拉树")
@ -73,7 +65,6 @@ public class MaTypeController extends BaseController {
/**
* 根据左列表类型id查询右表格
*
* @param typeId
* @return
*/
@ -87,15 +78,12 @@ 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) {
@ -195,21 +183,15 @@ public class MaTypeController extends BaseController {
/**
* 根据左列表类型id查询右表格
*
* @param typeId
* @return
*/
@ApiOperation(value = "根据左列表类型id查询右表格")
@GetMapping("/getListByMaType")
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));
public AjaxResult getListByMaType(@RequestParam(required = false) Long typeId,
@RequestParam(required = false) String typeName){
List<MaType> listByMaType = iTypeService.getListByParentId(typeId,typeName);
return success(listByMaType);
}
/**
@ -242,7 +224,8 @@ 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));
}
@ -252,7 +235,8 @@ 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)));
@ -267,7 +251,8 @@ 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,5 +89,4 @@ public interface MaTypeMapper {
List<MaTypeKeeper> selectMaTypeByUserId(Long userId);
List<Integer> selectParentId( @Param("typeId")Long typeId, @Param("level")Integer level);
}

View File

@ -67,7 +67,6 @@ 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,12 +58,7 @@ public class MaTypeServiceImpl implements ITypeService {
return 0;
}
MaType maType1 = maTypeMapper.selectMaTypeByTypeId(parentId);
String level;
if (maType1 == null) {
level = "0";
} else {
level = maType1.getLevel();
}
String level = maType1.getLevel();
maType.setLevel(String.valueOf(Integer.parseInt(level) + 1));
maType.setCreateTime(DateUtils.getNowDate());
System.out.println(maType);
@ -333,11 +328,6 @@ 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,17 +120,6 @@ 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,28 +426,6 @@
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.purchase_number,
pci.update_by,
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.purchase_number
pci.update_by, pci.update_time, pci.remark, pci.company_id, tk.code
from purchase_check_info pci
left join tm_task tk on pci.task_id = tk.task_id
where pci.task_id = #{taskId}
@ -79,7 +79,6 @@ 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>
@ -92,7 +91,6 @@ 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>
@ -108,7 +106,6 @@ 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>