修复规格,品牌等管理相关接口

This commit is contained in:
wulin 2020-09-21 17:05:19 +08:00
parent 55236f6487
commit 5c31bba531
14 changed files with 105 additions and 60 deletions

View File

@ -65,6 +65,7 @@ public class ShiroConfig {
filterMap.put("/aaa.txt", "anon"); filterMap.put("/aaa.txt", "anon");
filterMap.put("/dtlg/login", "anon"); filterMap.put("/dtlg/login", "anon");
filterMap.put("/oneCode/**", "anon"); filterMap.put("/oneCode/**", "anon");
filterMap.put("/modules/**", "anon");//临时添加后期去掉
filterMap.put("/dtlg/luck", "anon"); filterMap.put("/dtlg/luck", "anon");
filterMap.put("/dtlg/look", "anon"); filterMap.put("/dtlg/look", "anon");
filterMap.put("/dtlg/jump", "anon"); filterMap.put("/dtlg/jump", "anon");

View File

@ -139,11 +139,18 @@ public class EquipmentBrandController {
EquipmentType type = map.get(brand.getTypeId()); EquipmentType type = map.get(brand.getTypeId());
if(type !=null){ if(type !=null){
resp.setTypeName(type.getType()); resp.setTypeName(type.getType());
}else{
resp.setTypeName("【分类被删】");
} }
resps.add(resp); resps.add(resp);
} }
EquipmentType type = new EquipmentType();
type.setId(null);
type.setType("全部");
equipmentTypes.add(0, type);
return R.ok().put("total", page.getTotalCount()) return R.ok().put("total", page.getTotalCount())
.put("rows", resps) .put("rows", resps)
.put("types", equipmentTypes)
; ;
} }

View File

@ -41,6 +41,7 @@ public class EquipmentInfoController {
private TCountService tCountService; private TCountService tCountService;
/** /**
* 添加设备表页面 * 添加设备表页面
* *
@ -104,13 +105,13 @@ public class EquipmentInfoController {
public R equipmentInfoEdit(@RequestBody EquipmentInfoReq req) throws Exception { public R equipmentInfoEdit(@RequestBody EquipmentInfoReq req) throws Exception {
EquipmentInfo equipmentInfo = equipmentInfoService.selectEquipmentInfoById(req.getId()); EquipmentInfo equipmentInfo = equipmentInfoService.selectEquipmentInfoById(req.getId());
BeanUtils.copyProperty(equipmentInfo, req, true); BeanUtils.copyProperty(equipmentInfo, req, true);
Long typeId = NumberUtil.objToLongDefault(equipmentInfo.getType(), 0); /*Long typeId = NumberUtil.objToLongDefault(equipmentInfo.getType(), 0);
EquipmentType type = equipmentTypeService.selectEquipmentTypeById(typeId); EquipmentType type = equipmentTypeService.selectEquipmentTypeById(typeId);
equipmentInfo.setType(type.getType()); equipmentInfo.setType(type.getType());
Long brandId = NumberUtil.objToLongDefault(equipmentInfo.getBrandName(), 0); Long brandId = NumberUtil.objToLongDefault(equipmentInfo.getBrandName(), 0);
EquipmentBrand equipmentBrand = equipmentBrandService.selectEquipmentBrandById(brandId); EquipmentBrand equipmentBrand = equipmentBrandService.selectEquipmentBrandById(brandId);
equipmentInfo.setBrandName(equipmentBrand.getBrand()); equipmentInfo.setBrandName(equipmentBrand.getBrand());*/
equipmentInfoService.updateEquipmentInfoById(equipmentInfo); equipmentInfoService.updateEquipmentInfoById(equipmentInfo);
return R.ok("编辑成功"); return R.ok("编辑成功");
} }
@ -149,8 +150,17 @@ public class EquipmentInfoController {
*/ */
@RequestMapping(value = "/modules/usereq/equipmentInfoList") @RequestMapping(value = "/modules/usereq/equipmentInfoList")
public R equipmentInfoList(@RequestBody EquipmentInfoReq req) throws Exception { public R equipmentInfoList(@RequestBody EquipmentInfoReq req) throws Exception {
List<EquipmentType> types = equipmentTypeService.selectAll();
List<TCount> tcounts = tCountService.selectListLimit(10);
EquipmentType type = new EquipmentType();
type.setId(null);
type.setType("全部");
types.add(0, type);
PageUtils page = equipmentInfoService.selectByCondition(req); PageUtils page = equipmentInfoService.selectByCondition(req);
return R.ok().put("total", page.getTotalCount()) return R.ok().put("total", page.getTotalCount())
.put("rows", page.getList()); .put("rows", page.getList())
.put("types", types)
.put("tCounts", tcounts)
.put("curCount", req.getCount());
} }
} }

View File

@ -129,6 +129,11 @@ public class EquipmentSpecsController {
@RequestMapping(value = "/modules/specs/brandList") @RequestMapping(value = "/modules/specs/brandList")
public R brandList(@RequestBody EquipmentSpecsReq req) throws Exception { public R brandList(@RequestBody EquipmentSpecsReq req) throws Exception {
List<EquipmentBrand> brands = equipmentBrandService.selectByTypeId(req.getTypeId()); List<EquipmentBrand> brands = equipmentBrandService.selectByTypeId(req.getTypeId());
EquipmentBrand band = new EquipmentBrand();
band.setId(null);
band.setTypeId(null);
band.setBrand("全部");
brands.add(0, band);
return R.ok().put("brands",brands); return R.ok().put("brands",brands);
} }
@ -157,8 +162,22 @@ public class EquipmentSpecsController {
for (EquipmentSpecs specs : specsList) { for (EquipmentSpecs specs : specsList) {
EquipmentSpecsResp resp = new EquipmentSpecsResp(); EquipmentSpecsResp resp = new EquipmentSpecsResp();
resp.setId(specs.getId()); resp.setId(specs.getId());
resp.setType(typeMap.get(specs.getTypeId()).getType()); EquipmentType type = typeMap.get(specs.getTypeId());
resp.setBrand(brandMap.get(specs.getBrandId()).getBrand()); if(type == null){
resp.setType("【分类被删】");
}else{
resp.setType(type.getType());
resp.setTypeId(type.getId());
}
EquipmentBrand brand = brandMap.get(specs.getBrandId());
if(brand == null){
resp.setBrand("【品牌被删】");
}else{
resp.setBrand(brand.getBrand());
resp.setBrandId(brand.getId());
}
resp.setSpecs(specs.getSpecs()); resp.setSpecs(specs.getSpecs());
resp.setRank(specs.getRank()); resp.setRank(specs.getRank());
resp.setSkus(specs.getSkus()); resp.setSkus(specs.getSkus());
@ -166,7 +185,12 @@ public class EquipmentSpecsController {
resp.setRemark(specs.getRemark()); resp.setRemark(specs.getRemark());
resps.add(resp); resps.add(resp);
} }
EquipmentType type = new EquipmentType();
type.setId(null);
type.setType("全部");
types.add(0, type);
return R.ok().put("total", page.getTotalCount()) return R.ok().put("total", page.getTotalCount())
.put("rows", resps); .put("rows", resps)
.put("types", types);
} }
} }

View File

@ -38,7 +38,7 @@ public interface EquipmentBrandMapper extends BaseMapper<EquipmentBrand> {
EquipmentBrand selectEquipmentBrandByTypeBrand(@Param("typeId") Long typeId, @Param("brand") String brand); EquipmentBrand selectEquipmentBrandByTypeBrand(@Param("typeId") Long typeId, @Param("brand") String brand);
List<EquipmentBrand> selectByCondition(IPage page, EquipmentBrandReq req); List<EquipmentBrand> selectByCondition(@Param("page") IPage page, @Param("req") EquipmentBrandReq req);
List<EquipmentBrand> selectEquipmentBrandByTypeAndLikeBrand(@Param("typeId") Long typeId, @Param("brand") String brand); List<EquipmentBrand> selectEquipmentBrandByTypeAndLikeBrand(@Param("typeId") Long typeId, @Param("brand") String brand);
List<EquipmentBrand> selectAll(); List<EquipmentBrand> selectAll();

View File

@ -39,7 +39,7 @@ public interface EquipmentInfoMapper extends BaseMapper<EquipmentInfo> {
EquipmentInfo selectEquipmentInfoByCode(@Param("code") String code); EquipmentInfo selectEquipmentInfoByCode(@Param("code") String code);
List<EquipmentInfo> selectByCondition(IPage page, EquipmentInfoReq req); List<EquipmentInfo> selectByCondition(@Param("page") IPage page, @Param("req") EquipmentInfoReq req);
List<EquipmentInfo> selectByStaffIdOrDepId(@Param("page") IPage page, @Param("nameModel") FindEquipmentsByNameModel nameModel); List<EquipmentInfo> selectByStaffIdOrDepId(@Param("page") IPage page, @Param("nameModel") FindEquipmentsByNameModel nameModel);
} }

View File

@ -37,7 +37,7 @@ public interface EquipmentSpecsMapper extends BaseMapper<EquipmentSpecs> {
EquipmentSpecs selectEquipmentSpecsByTypeBrandSpecss(@Param("typeId") Long typeId, @Param("brandId") Long brandId, @Param("specs") String specs); EquipmentSpecs selectEquipmentSpecsByTypeBrandSpecss(@Param("typeId") Long typeId, @Param("brandId") Long brandId, @Param("specs") String specs);
List<EquipmentSpecs> selectByCondition(IPage page, EquipmentSpecsReq req); List<EquipmentSpecs> selectByCondition(@Param("page") IPage page, @Param("req") EquipmentSpecsReq req);
List<EquipmentSpecs> selectEquipmentSpecsByTypeBrandLikeSpecss(@Param("typeId") Long typeId, @Param("brandId") Long brandId, @Param("specs") String specs); List<EquipmentSpecs> selectEquipmentSpecsByTypeBrandLikeSpecss(@Param("typeId") Long typeId, @Param("brandId") Long brandId, @Param("specs") String specs);
EquipmentSpecs selectSpecs(@Param("specs") String specs); EquipmentSpecs selectSpecs(@Param("specs") String specs);

View File

@ -41,7 +41,7 @@ public interface EquipmentTypeMapper extends BaseMapper<EquipmentType> {
List<EquipmentType> selectByType(@Param("type") String type); List<EquipmentType> selectByType(@Param("type") String type);
List<EquipmentType> selectByCondition(IPage page, EquipmentTypeReq req); List<EquipmentType> selectByCondition(@Param("page") IPage page, @Param("req") EquipmentTypeReq req);
List<EquipmentType> selectAll(); List<EquipmentType> selectAll();

View File

@ -16,6 +16,7 @@ import com.lz.modules.equipment.entity.model.FindByNameModel;
import com.lz.modules.equipment.entity.model.FindEquipmentsByNameModel; import com.lz.modules.equipment.entity.model.FindEquipmentsByNameModel;
import com.lz.modules.equipment.service.IEquipmentInfoService; import com.lz.modules.equipment.service.IEquipmentInfoService;
import com.lz.modules.sys.entity.SysUserEntity; import com.lz.modules.sys.entity.SysUserEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -33,6 +34,7 @@ import java.util.List;
*/ */
@Service @Service
@Slf4j
public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, EquipmentInfo> implements IEquipmentInfoService { public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, EquipmentInfo> implements IEquipmentInfoService {
@ -98,6 +100,7 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
@Override @Override
public void changeEquipmentInfo(EquipmentDto dto, SysUserEntity infoDto) { public void changeEquipmentInfo(EquipmentDto dto, SysUserEntity infoDto) {
log.info("编辑传入内容{}", dto);
EquipmentType equipmentType = equipmentTypeMapper.selectEquipmentTypeById(dto.getTypeId()); EquipmentType equipmentType = equipmentTypeMapper.selectEquipmentTypeById(dto.getTypeId());
EquipmentBrand equipmentBrand = equipmentBrandMapper.selectEquipmentBrandById(dto.getBrandId()); EquipmentBrand equipmentBrand = equipmentBrandMapper.selectEquipmentBrandById(dto.getBrandId());
EquipmentSpecs equipmentSpecs = equipmentSpecsMapper.selectEquipmentSpecsById(dto.getSpecId()); EquipmentSpecs equipmentSpecs = equipmentSpecsMapper.selectEquipmentSpecsById(dto.getSpecId());

View File

@ -89,9 +89,9 @@
<select id="selectByCondition" resultType="com.lz.modules.equipment.entity.EquipmentBrand"> <select id="selectByCondition" resultType="com.lz.modules.equipment.entity.EquipmentBrand">
select * from equipment_brand where is_delete = 0 select * from equipment_brand where is_delete = 0
<if test="typeId != null">and type_id = #{typeId}</if> <if test="req.typeId != null">and type_id = #{req.typeId}</if>
<if test="brand != null and brand != '' "> <if test="req.brand != null and req.brand != '' ">
AND brand LIKE CONCAT('%',#{brand},'%') AND brand LIKE CONCAT('%',#{req.brand},'%')
</if> </if>
order by rank desc , id desc order by rank desc , id desc
</select> </select>

View File

@ -171,60 +171,60 @@
<select id="selectByCondition" resultType="com.lz.modules.equipment.entity.EquipmentInfo"> <select id="selectByCondition" resultType="com.lz.modules.equipment.entity.EquipmentInfo">
select * from equipment_info where is_delete = 0 select * from equipment_info where is_delete = 0
<if test="type != null">and type = #{type}</if> <if test="req.type != null">and type = #{req.type}</if>
<if test="brandName != null">and brand_name = #{brandName}</if> <if test="req.brandName != null">and brand_name = #{req.brandName}</if>
<if test="specType != null and specType != '' "> <if test="req.specType != null and req.specType != '' ">
AND spec_type LIKE CONCAT('%',#{specType},'%') AND spec_type LIKE CONCAT('%',#{req.specType},'%')
</if> </if>
<if test="equipmentState != null">and equipment_state = #{equipmentState}</if> <if test="req.equipmentState != null">and equipment_state = #{req.equipmentState}</if>
<if test="user != null and user != '' "> <if test="req.user != null and req.user != '' ">
AND user LIKE CONCAT('%',#{user},'%') AND user LIKE CONCAT('%',#{req.user},'%')
</if> </if>
<if test="owner != null and owner != '' "> <if test="req.owner != null and req.owner != '' ">
AND owner LIKE CONCAT('%',#{owner},'%') AND owner LIKE CONCAT('%',#{req.owner},'%')
</if> </if>
<if test="gmtInStartTime != null and gmtInStartTime != '' "> <if test="req.gmtInStartTime != null and req.gmtInStartTime != '' ">
AND DATE_FORMAT(gmt_inbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{gmtInStartTime}, '%Y-%m-%d %H:%i:%S') AND DATE_FORMAT(gmt_inbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{req.gmtInStartTime}, '%Y-%m-%d %H:%i:%S')
</if> </if>
<if test="gmtInEndTime != null and gmtInEndTime != '' "> <if test="req.gmtInEndTime != null and req.gmtInEndTime != '' ">
AND DATE_FORMAT(gmt_inbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> DATE_FORMAT(#{gmtInEndTime}, '%Y-%m-%d %H:%i:%S') AND DATE_FORMAT(gmt_inbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> DATE_FORMAT(#{req.gmtInEndTime}, '%Y-%m-%d %H:%i:%S')
</if> </if>
<if test="gmtOutStartTime != null and gmtOutStartTime != '' "> <if test="req.gmtOutStartTime != null and req.gmtOutStartTime != '' ">
AND DATE_FORMAT(gmt_outbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{gmtOutStartTime}, '%Y-%m-%d %H:%i:%S') AND DATE_FORMAT(gmt_outbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{req.gmtOutStartTime}, '%Y-%m-%d %H:%i:%S')
</if> </if>
<if test="gmtOutEndTime != null and gmtOutEndTime != '' "> <if test="req.gmtOutEndTime != null and req.gmtOutEndTime != '' ">
AND DATE_FORMAT(gmt_outbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> DATE_FORMAT(#{gmtOutEndTime}, '%Y-%m-%d %H:%i:%S') AND DATE_FORMAT(gmt_outbound, '%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> DATE_FORMAT(#{req.gmtOutEndTime}, '%Y-%m-%d %H:%i:%S')
</if> </if>
<if test="mark != null and mark != '' "> <if test="req.mark != null and req.mark != '' ">
AND mark LIKE CONCAT('%',#{mark},'%') AND mark LIKE CONCAT('%',#{req.mark},'%')
</if> </if>
<if test="originalCode != null and originalCode != '' "> <if test="req.originalCode != null and req.originalCode != '' ">
AND original_code LIKE CONCAT('%',#{originalCode},'%') AND original_code LIKE CONCAT('%',#{req.originalCode},'%')
</if> </if>
<if test="code != null and code != '' "> <if test="req.code != null and req.code != '' ">
AND code LIKE CONCAT('%',#{code},'%') AND code LIKE CONCAT('%',#{req.code},'%')
</if> </if>
<if test="qr != null and qr != '' "> <if test="req.qr != null and req.qr != '' ">
AND qr LIKE CONCAT('%',#{qr},'%') AND qr LIKE CONCAT('%',#{req.qr},'%')
</if> </if>
<choose> <choose>
<when test="other != null and other == 2"> <when test="req.other != null and req.other == 2">
AND count = #{count}-1 AND count = #{req.count}-1
</when> </when>
<otherwise> <otherwise>
AND count = #{count} AND count = #{req.count}
</otherwise> </otherwise>
</choose> </choose>
<if test="other != null and other != '' "> <if test="req.other != null and req.other != '' ">
<if test="other==1"> <if test="req.other==1">
AND mark !='' and mark is not null AND mark !='' and mark is not null
</if> </if>
<if test="other==2"> <if test="req.other==2">
and code not in (select code from equipment_info where is_delete = 0 AND count = #{count}) and code not in (select code from equipment_info where is_delete = 0 AND count = #{req.count})
</if> </if>
<if test="other==3"> <if test="req.other==3">
and equipment_state = 2 and equipment_state = 2
</if> </if>

View File

@ -103,12 +103,12 @@
</select> </select>
<select id="selectByCondition" resultType="com.lz.modules.equipment.entity.EquipmentSpecs"> <select id="selectByCondition" resultType="EquipmentSpecs">
select * from equipment_specs where is_delete = 0 select * from equipment_specs where is_delete = 0
<if test="typeId != null">and type_id = #{typeId}</if> <if test="req.typeId != null">and type_id = #{req.typeId}</if>
<if test="brandId != null">and brand_id = #{brandId}</if> <if test="req.brandId != null">and brand_id = #{req.brandId}</if>
<if test="specs != null and specs != '' "> <if test="req.specs != null and req.specs != '' ">
AND specs LIKE CONCAT('%',#{specs},'%') AND specs LIKE CONCAT('%',#{req.specs},'%')
</if> </if>
order by rank desc, id desc order by rank desc, id desc
</select> </select>

View File

@ -95,8 +95,8 @@
<select id="selectByCondition" resultType="EquipmentType"> <select id="selectByCondition" resultType="EquipmentType">
select * from equipment_type where is_delete = 0 select * from equipment_type where is_delete = 0
<if test="type != null and type != '' "> <if test="req.type != null and req.type != '' ">
AND type LIKE CONCAT('%',#{type},'%') AND type LIKE CONCAT('%',#{req.type},'%')
</if> </if>
order by rank desc , id desc order by rank desc , id desc

View File

@ -21,12 +21,12 @@
<select id="selectTCountById" resultType="TCount" > <select id="selectTCountById" resultType="TCount" >
select * from t_count where id=#{id} and is_delete = 0 limit 1 select * from equipment_t_count where id=#{id} and is_delete = 0 limit 1
</select> </select>
<insert id="insertTCount" parameterType="TCount" useGeneratedKeys="true" keyProperty="id" > <insert id="insertTCount" parameterType="TCount" useGeneratedKeys="true" keyProperty="id" >
insert into t_count( insert into equipment_t_count(
<if test="num != null">num, </if> <if test="num != null">num, </if>
is_delete, is_delete,
gmt_create, gmt_create,
@ -42,7 +42,7 @@
<update id="updateTCountById" parameterType="TCount" > <update id="updateTCountById" parameterType="TCount" >
update update
t_count equipment_t_count
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if> <if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if> <if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
@ -55,7 +55,7 @@
<update id="updateCoverTCountById" parameterType="TCount" > <update id="updateCoverTCountById" parameterType="TCount" >
update update
t_count equipment_t_count
set set
is_delete = #{isDelete}, is_delete = #{isDelete},
gmt_create = #{gmtCreate}, gmt_create = #{gmtCreate},
@ -66,14 +66,14 @@
<update id="deleteTCountById" parameterType="java.lang.Long"> <update id="deleteTCountById" parameterType="java.lang.Long">
update t_count set is_delete = 1 where id=#{id} limit 1 update equipment_t_count set is_delete = 1 where id=#{id} limit 1
</update> </update>
<select id="selectMaxCount" resultType="com.lz.modules.equipment.entity.TCount"> <select id="selectMaxCount" resultType="com.lz.modules.equipment.entity.TCount">
select * from t_count order by id desc limit 1 select * from equipment_t_count order by id desc limit 1
</select> </select>
<select id="selectListLimit" resultType="com.lz.modules.equipment.entity.TCount"> <select id="selectListLimit" resultType="com.lz.modules.equipment.entity.TCount">
select * from t_count order by id desc limit #{limit} select * from equipment_t_count order by id desc limit #{limit}
</select> </select>