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

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("/dtlg/login", "anon");
filterMap.put("/oneCode/**", "anon");
filterMap.put("/modules/**", "anon");//临时添加后期去掉
filterMap.put("/dtlg/luck", "anon");
filterMap.put("/dtlg/look", "anon");
filterMap.put("/dtlg/jump", "anon");

View File

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

View File

@ -41,6 +41,7 @@ public class EquipmentInfoController {
private TCountService tCountService;
/**
* 添加设备表页面
*
@ -104,13 +105,13 @@ public class EquipmentInfoController {
public R equipmentInfoEdit(@RequestBody EquipmentInfoReq req) throws Exception {
EquipmentInfo equipmentInfo = equipmentInfoService.selectEquipmentInfoById(req.getId());
BeanUtils.copyProperty(equipmentInfo, req, true);
Long typeId = NumberUtil.objToLongDefault(equipmentInfo.getType(), 0);
/*Long typeId = NumberUtil.objToLongDefault(equipmentInfo.getType(), 0);
EquipmentType type = equipmentTypeService.selectEquipmentTypeById(typeId);
equipmentInfo.setType(type.getType());
Long brandId = NumberUtil.objToLongDefault(equipmentInfo.getBrandName(), 0);
EquipmentBrand equipmentBrand = equipmentBrandService.selectEquipmentBrandById(brandId);
equipmentInfo.setBrandName(equipmentBrand.getBrand());
equipmentInfo.setBrandName(equipmentBrand.getBrand());*/
equipmentInfoService.updateEquipmentInfoById(equipmentInfo);
return R.ok("编辑成功");
}
@ -149,8 +150,17 @@ public class EquipmentInfoController {
*/
@RequestMapping(value = "/modules/usereq/equipmentInfoList")
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);
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")
public R brandList(@RequestBody EquipmentSpecsReq req) throws Exception {
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);
}
@ -157,8 +162,22 @@ public class EquipmentSpecsController {
for (EquipmentSpecs specs : specsList) {
EquipmentSpecsResp resp = new EquipmentSpecsResp();
resp.setId(specs.getId());
resp.setType(typeMap.get(specs.getTypeId()).getType());
resp.setBrand(brandMap.get(specs.getBrandId()).getBrand());
EquipmentType type = typeMap.get(specs.getTypeId());
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.setRank(specs.getRank());
resp.setSkus(specs.getSkus());
@ -166,7 +185,12 @@ public class EquipmentSpecsController {
resp.setRemark(specs.getRemark());
resps.add(resp);
}
EquipmentType type = new EquipmentType();
type.setId(null);
type.setType("全部");
types.add(0, type);
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);
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> selectAll();

View File

@ -39,7 +39,7 @@ public interface EquipmentInfoMapper extends BaseMapper<EquipmentInfo> {
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);
}

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,12 +21,12 @@
<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>
<insert id="insertTCount" parameterType="TCount" useGeneratedKeys="true" keyProperty="id" >
insert into t_count(
insert into equipment_t_count(
<if test="num != null">num, </if>
is_delete,
gmt_create,
@ -42,7 +42,7 @@
<update id="updateTCountById" parameterType="TCount" >
update
t_count
equipment_t_count
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
@ -55,7 +55,7 @@
<update id="updateCoverTCountById" parameterType="TCount" >
update
t_count
equipment_t_count
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
@ -66,14 +66,14 @@
<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>
<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 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>