新增物价类别
parent
4b99f2841d
commit
871433c022
@ -0,0 +1,46 @@
|
||||
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.req.thrsys.FilterThrHslbRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.service.thrsys.ThrHslbService;
|
||||
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 ThrHslbController {
|
||||
|
||||
@Resource
|
||||
ThrHslbService thrHslbService;
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@GetMapping("/udiwms/thrsys/getHslbs")
|
||||
public BaseResponse getHslbs(FilterThrHslbRequest filterThrHslbRequest,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
List<ThrHslbEntity> thrHslbEntities
|
||||
= thrHslbService.getHslbs(filterThrHslbRequest);
|
||||
PageInfo<ThrHslbEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(thrHslbEntities);
|
||||
PageSimpleResponse<ThrHslbEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(thrHslbEntities);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.glxp.api.dao.thrsys;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.glxp.api.entity.thrsys.ThrHslbEntity;
|
||||
import com.glxp.api.req.thrsys.FilterThrHslbRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ThrHslbMapper extends BaseMapper<ThrHslbEntity> {
|
||||
|
||||
List<ThrHslbEntity> getHslbs(FilterThrHslbRequest filterThrHslbRequest);
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
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 lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "thr_hslb")
|
||||
public class ThrHslbEntity implements Serializable {
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
private Integer id;
|
||||
|
||||
@TableField(value = "hslb")
|
||||
private String hslb;
|
||||
|
||||
@TableField(value = "hsmc")
|
||||
private String hsmc;
|
||||
|
||||
@TableField(value = "hsbm")
|
||||
private String hsbm;
|
||||
|
||||
@TableField(value = "remark")
|
||||
private String remark;
|
||||
|
||||
@TableField(value = "updateTime")
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(value = "createTime")
|
||||
private Date createTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.glxp.api.req.thrsys;
|
||||
|
||||
import com.glxp.api.util.page.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FilterThrHslbRequest extends ListPageRequest {
|
||||
|
||||
private String key;
|
||||
private String code;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.glxp.api.service.thrsys;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.dao.thrsys.ThrHslbMapper;
|
||||
import com.glxp.api.entity.thrsys.ThrHslbEntity;
|
||||
import com.glxp.api.req.thrsys.FilterThrHslbRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ThrHslbService extends ServiceImpl<ThrHslbMapper, ThrHslbEntity> {
|
||||
|
||||
@Resource
|
||||
ThrHslbMapper thrHslbMapper;
|
||||
|
||||
public List<ThrHslbEntity> getHslbs(FilterThrHslbRequest filterThrHslbRequest) {
|
||||
if (filterThrHslbRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterThrHslbRequest.getPage() != null) {
|
||||
int offset = (filterThrHslbRequest.getPage() - 1) * filterThrHslbRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterThrHslbRequest.getLimit());
|
||||
}
|
||||
List<ThrHslbEntity> data = thrHslbMapper.getHslbs(filterThrHslbRequest);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?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.ThrHslbMapper">
|
||||
<resultMap id="BaseResultMap" type="com.glxp.api.entity.thrsys.ThrHslbEntity">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table thr_hslb-->
|
||||
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||
<result column="hslb" jdbcType="VARCHAR" property="hslb"/>
|
||||
<result column="hsmc" jdbcType="VARCHAR" property="hsmc"/>
|
||||
<result column="hsbm" jdbcType="VARCHAR" property="hsbm"/>
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
||||
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, hslb, hsmc, hsbm, remark, updateTime, createTime
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="getHslbs" parameterType="com.glxp.api.req.thrsys.FilterThrHslbRequest"
|
||||
resultType="com.glxp.api.entity.thrsys.ThrHslbEntity">
|
||||
SELECT *
|
||||
FROM thr_hslb
|
||||
<where>
|
||||
<if test="key != '' and key != null">
|
||||
AND (hslb LIKE concat('%', #{key}, '%') or hsmc LIKE concat('%', #{key}, '%') or
|
||||
hsbm LIKE concat('%', #{key}, '%'))
|
||||
</if>
|
||||
<if test="code != '' and code != null">
|
||||
AND hsbm = #{code}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue