长泰新增配送产品,物资分类问题
							parent
							
								
									a0f90b9653
								
							
						
					
					
						commit
						f79458bb45
					
				| @ -0,0 +1,47 @@ | |||||||
|  | package com.glxp.api.controller.thrsys; | ||||||
|  | 
 | ||||||
|  | import com.github.pagehelper.PageInfo; | ||||||
|  | import com.glxp.api.annotation.AuthRuleAnnotation; | ||||||
|  | import com.glxp.api.common.enums.ResultEnum; | ||||||
|  | import com.glxp.api.common.res.BaseResponse; | ||||||
|  | import com.glxp.api.common.util.ResultVOUtils; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrHslbEntity; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductTypeEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrHslbRequest; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductTypeRequest; | ||||||
|  | import com.glxp.api.res.PageSimpleResponse; | ||||||
|  | import com.glxp.api.service.thrsys.ThrHslbService; | ||||||
|  | import com.glxp.api.service.thrsys.ThrProductTypeService; | ||||||
|  | import lombok.extern.slf4j.Slf4j; | ||||||
|  | import org.springframework.validation.BindingResult; | ||||||
|  | import org.springframework.web.bind.annotation.GetMapping; | ||||||
|  | import org.springframework.web.bind.annotation.RestController; | ||||||
|  | 
 | ||||||
|  | import javax.annotation.Resource; | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Slf4j | ||||||
|  | @RestController | ||||||
|  | public class ThrProductTypeCotroller { | ||||||
|  | 
 | ||||||
|  |     @Resource | ||||||
|  |     ThrProductTypeService thrProductTypeService; | ||||||
|  | 
 | ||||||
|  |     @AuthRuleAnnotation("") | ||||||
|  |     @GetMapping("/udiwms/thrsys/getHslbs") | ||||||
|  |     public BaseResponse getProductTypes(FilterThrProductTypeRequest filterThrProductTypeRequest, | ||||||
|  |                                         BindingResult bindingResult) { | ||||||
|  | 
 | ||||||
|  |         if (bindingResult.hasErrors()) { | ||||||
|  |             return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); | ||||||
|  |         } | ||||||
|  |         List<ThrProductTypeEntity> thrProductTypeEntityList | ||||||
|  |                 = thrProductTypeService.getProductTypes(filterThrProductTypeRequest); | ||||||
|  |         PageInfo<ThrProductTypeEntity> pageInfo; | ||||||
|  |         pageInfo = new PageInfo<ThrProductTypeEntity>(thrProductTypeEntityList); | ||||||
|  |         PageSimpleResponse<ThrProductTypeEntity> pageSimpleResponse = new PageSimpleResponse<>(); | ||||||
|  |         pageSimpleResponse.setTotal(pageInfo.getTotal()); | ||||||
|  |         pageSimpleResponse.setList(thrProductTypeEntityList); | ||||||
|  |         return ResultVOUtils.success(pageSimpleResponse); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,16 @@ | |||||||
|  | package com.glxp.api.dao.thrsys; | ||||||
|  | 
 | ||||||
|  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductTypeEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrHslbRequest; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductTypeRequest; | ||||||
|  | import org.apache.ibatis.annotations.Mapper; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Mapper | ||||||
|  | public interface ThrProductTypeMapper extends BaseMapper<ThrProductTypeEntity> { | ||||||
|  | 
 | ||||||
|  |     List<ThrProductTypeEntity> getProductTypes(FilterThrProductTypeRequest filterThrProductTypeRequest); | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,55 @@ | |||||||
|  | package com.glxp.api.entity.thrsys; | ||||||
|  | 
 | ||||||
|  | import com.baomidou.mybatisplus.annotation.IdType; | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableField; | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableId; | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableName; | ||||||
|  | import io.swagger.annotations.ApiModel; | ||||||
|  | import io.swagger.annotations.ApiModelProperty; | ||||||
|  | import java.io.Serializable; | ||||||
|  | import lombok.AllArgsConstructor; | ||||||
|  | import lombok.Builder; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.NoArgsConstructor; | ||||||
|  | 
 | ||||||
|  | @ApiModel(value="com-glxp-api-entity-thrsys-ThrProductType") | ||||||
|  | @Data | ||||||
|  | @Builder | ||||||
|  | @AllArgsConstructor | ||||||
|  | @NoArgsConstructor | ||||||
|  | @TableName(value = "thr_product_type") | ||||||
|  | public class ThrProductTypeEntity implements Serializable { | ||||||
|  |     @TableId(value = "id", type = IdType.INPUT) | ||||||
|  |     @ApiModelProperty(value="") | ||||||
|  |     private Integer id; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 类别编码 | ||||||
|  |      */ | ||||||
|  |     @TableField(value = "code") | ||||||
|  |     @ApiModelProperty(value="类别编码") | ||||||
|  |     private String code; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 类别名称 | ||||||
|  |      */ | ||||||
|  |     @TableField(value = "`name`") | ||||||
|  |     @ApiModelProperty(value="类别名称") | ||||||
|  |     private String name; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 第三系统标识 | ||||||
|  |      */ | ||||||
|  |     @TableField(value = "thirdSys") | ||||||
|  |     @ApiModelProperty(value="第三系统标识") | ||||||
|  |     private String thirdSys; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 备注 | ||||||
|  |      */ | ||||||
|  |     @TableField(value = "remark") | ||||||
|  |     @ApiModelProperty(value="备注") | ||||||
|  |     private String remark; | ||||||
|  | 
 | ||||||
|  |     private static final long serialVersionUID = 1L; | ||||||
|  | } | ||||||
| @ -0,0 +1,28 @@ | |||||||
|  | package com.glxp.api.req.thrsys; | ||||||
|  | 
 | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableField; | ||||||
|  | import com.glxp.api.util.page.ListPageRequest; | ||||||
|  | import io.swagger.annotations.ApiModelProperty; | ||||||
|  | import lombok.Data; | ||||||
|  | 
 | ||||||
|  | @Data | ||||||
|  | public class FilterThrProductTypeRequest extends ListPageRequest { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 类别编码 | ||||||
|  |      */ | ||||||
|  |     private String code; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 类别名称 | ||||||
|  |      */ | ||||||
|  |     private String name; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 第三系统标识 | ||||||
|  |      */ | ||||||
|  |     private String thirdSys; | ||||||
|  | 
 | ||||||
|  |     private String key; | ||||||
|  | } | ||||||
| @ -0,0 +1,32 @@ | |||||||
|  | package com.glxp.api.service.thrsys; | ||||||
|  | 
 | ||||||
|  | import com.github.pagehelper.PageHelper; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrHslbEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrHslbRequest; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductTypeRequest; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductTypeEntity; | ||||||
|  | import com.glxp.api.dao.thrsys.ThrProductTypeMapper; | ||||||
|  | 
 | ||||||
|  | import javax.annotation.Resource; | ||||||
|  | import java.util.Collections; | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Service | ||||||
|  | public class ThrProductTypeService extends ServiceImpl<ThrProductTypeMapper, ThrProductTypeEntity> { | ||||||
|  |     @Resource | ||||||
|  |     ThrProductTypeMapper thrProductTypeMapper; | ||||||
|  | 
 | ||||||
|  |     public List<ThrProductTypeEntity> getProductTypes(FilterThrProductTypeRequest filterThrProductTypeRequest) { | ||||||
|  |         if (filterThrProductTypeRequest == null) { | ||||||
|  |             return Collections.emptyList(); | ||||||
|  |         } | ||||||
|  |         if (filterThrProductTypeRequest.getPage() != null) { | ||||||
|  |             int offset = (filterThrProductTypeRequest.getPage() - 1) * filterThrProductTypeRequest.getLimit(); | ||||||
|  |             PageHelper.offsetPage(offset, filterThrProductTypeRequest.getLimit()); | ||||||
|  |         } | ||||||
|  |         List<ThrProductTypeEntity> data = thrProductTypeMapper.getProductTypes(filterThrProductTypeRequest); | ||||||
|  |         return data; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,33 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||||
|  | <mapper namespace="com.glxp.api.dao.thrsys.ThrProductTypeMapper"> | ||||||
|  |     <resultMap id="BaseResultMap" type="com.glxp.api.entity.thrsys.ThrProductTypeEntity"> | ||||||
|  |         <!--@mbg.generated--> | ||||||
|  |         <!--@Table thr_product_type--> | ||||||
|  |         <id column="id" jdbcType="INTEGER" property="id"/> | ||||||
|  |         <result column="code" jdbcType="VARCHAR" property="code"/> | ||||||
|  |         <result column="name" jdbcType="VARCHAR" property="name"/> | ||||||
|  |         <result column="thirdSys" jdbcType="VARCHAR" property="thirdSys"/> | ||||||
|  |         <result column="remark" jdbcType="VARCHAR" property="remark"/> | ||||||
|  |     </resultMap> | ||||||
|  |     <sql id="Base_Column_List"> | ||||||
|  |         <!--@mbg.generated--> | ||||||
|  |         id, code, `name`, thirdSys, remark | ||||||
|  |     </sql> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     <select id="getProductTypes" parameterType="com.glxp.api.req.thrsys.FilterThrProductTypeRequest" | ||||||
|  |             resultType="com.glxp.api.entity.thrsys.ThrProductTypeEntity"> | ||||||
|  |         SELECT * | ||||||
|  |         FROM thr_product_type | ||||||
|  |         <where> | ||||||
|  |             <if test="key != '' and key != null"> | ||||||
|  |                 AND (code LIKE concat('%', #{key}, '%') or name LIKE concat('%', #{key}, '%') | ||||||
|  |                     ) | ||||||
|  |             </if> | ||||||
|  |             <if test="code != '' and code != null"> | ||||||
|  |                 AND code = #{code} | ||||||
|  |             </if> | ||||||
|  |         </where> | ||||||
|  |     </select> | ||||||
|  | </mapper> | ||||||
					Loading…
					
					
				
		Reference in New Issue