给角色模块增加价格屏蔽字段

This commit is contained in:
季圣华 2022-10-23 16:21:21 +08:00
parent c4ad9344dc
commit 927a4fa12c
8 changed files with 132 additions and 16 deletions

View File

@ -719,6 +719,7 @@ CREATE TABLE `jsh_role` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(50) DEFAULT NULL COMMENT '名称',
`type` varchar(50) DEFAULT NULL COMMENT '类型',
`price_limit` varchar(50) DEFAULT NULL COMMENT '价格屏蔽 1-屏蔽采购价 2-屏蔽零售价 3-屏蔽销售价',
`value` varchar(200) DEFAULT NULL COMMENT '',
`description` varchar(100) DEFAULT NULL COMMENT '描述',
`enabled` bit(1) DEFAULT NULL COMMENT '启用',
@ -731,10 +732,10 @@ CREATE TABLE `jsh_role` (
-- ----------------------------
-- Records of jsh_role
-- ----------------------------
INSERT INTO `jsh_role` VALUES ('4', '管理员', '全部数据', null, null, '', null, null, '0');
INSERT INTO `jsh_role` VALUES ('10', '租户', '全部数据', null, '', '', null, null, '0');
INSERT INTO `jsh_role` VALUES ('16', '销售经理', '全部数据', null, 'ddd', '', null, '63', '0');
INSERT INTO `jsh_role` VALUES ('17', '销售代表', '个人数据', null, 'rrr', '', null, '63', '0');
INSERT INTO `jsh_role` VALUES ('4', '管理员', '全部数据', null, null, null, '', null, null, '0');
INSERT INTO `jsh_role` VALUES ('10', '租户', '全部数据', null, null, '', '', null, null, '0');
INSERT INTO `jsh_role` VALUES ('16', '销售经理', '全部数据', null, null, 'ddd', '', null, '63', '0');
INSERT INTO `jsh_role` VALUES ('17', '销售代表', '个人数据', null, null, 'rrr', '', null, '63', '0');
-- ----------------------------
-- Table structure for jsh_sequence

View File

@ -1414,4 +1414,11 @@ alter table jsh_account_head change remark remark varchar(1000) DEFAULT NULL COM
-- by jishenghua
-- 给单据明细增加采购单价字段
-- --------------------------------------------------------
alter table jsh_depot_item add purchase_unit_price decimal(24,6) DEFAULT NULL COMMENT '采购单价' after unit_price;
alter table jsh_depot_item add purchase_unit_price decimal(24,6) DEFAULT NULL COMMENT '采购单价' after unit_price;
-- --------------------------------------------------------
-- 时间 2022年10月23日
-- by jishenghua
-- 给角色表增加价格屏蔽字段
-- --------------------------------------------------------
alter table jsh_role add price_limit varchar(50) DEFAULT NULL COMMENT '价格屏蔽 1-屏蔽采购价 2-屏蔽零售价 3-屏蔽销售价' after type;

View File

@ -7,6 +7,8 @@ public class Role {
private String type;
private String priceLimit;
private String value;
private String description;
@ -43,6 +45,14 @@ public class Role {
this.type = type == null ? null : type.trim();
}
public String getPriceLimit() {
return priceLimit;
}
public void setPriceLimit(String priceLimit) {
this.priceLimit = priceLimit == null ? null : priceLimit.trim();
}
public String getValue() {
return value;
}

View File

@ -304,6 +304,76 @@ public class RoleExample {
return (Criteria) this;
}
public Criteria andPriceLimitIsNull() {
addCriterion("price_limit is null");
return (Criteria) this;
}
public Criteria andPriceLimitIsNotNull() {
addCriterion("price_limit is not null");
return (Criteria) this;
}
public Criteria andPriceLimitEqualTo(String value) {
addCriterion("price_limit =", value, "priceLimit");
return (Criteria) this;
}
public Criteria andPriceLimitNotEqualTo(String value) {
addCriterion("price_limit <>", value, "priceLimit");
return (Criteria) this;
}
public Criteria andPriceLimitGreaterThan(String value) {
addCriterion("price_limit >", value, "priceLimit");
return (Criteria) this;
}
public Criteria andPriceLimitGreaterThanOrEqualTo(String value) {
addCriterion("price_limit >=", value, "priceLimit");
return (Criteria) this;
}
public Criteria andPriceLimitLessThan(String value) {
addCriterion("price_limit <", value, "priceLimit");
return (Criteria) this;
}
public Criteria andPriceLimitLessThanOrEqualTo(String value) {
addCriterion("price_limit <=", value, "priceLimit");
return (Criteria) this;
}
public Criteria andPriceLimitLike(String value) {
addCriterion("price_limit like", value, "priceLimit");
return (Criteria) this;
}
public Criteria andPriceLimitNotLike(String value) {
addCriterion("price_limit not like", value, "priceLimit");
return (Criteria) this;
}
public Criteria andPriceLimitIn(List<String> values) {
addCriterion("price_limit in", values, "priceLimit");
return (Criteria) this;
}
public Criteria andPriceLimitNotIn(List<String> values) {
addCriterion("price_limit not in", values, "priceLimit");
return (Criteria) this;
}
public Criteria andPriceLimitBetween(String value1, String value2) {
addCriterion("price_limit between", value1, value2, "priceLimit");
return (Criteria) this;
}
public Criteria andPriceLimitNotBetween(String value1, String value2) {
addCriterion("price_limit not between", value1, value2, "priceLimit");
return (Criteria) this;
}
public Criteria andValueIsNull() {
addCriterion("value is null");
return (Criteria) this;

View File

@ -1,6 +1,7 @@
package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.Role;
import com.jsh.erp.datasource.entities.RoleEx;
import com.jsh.erp.datasource.entities.RoleExample;
import org.apache.ibatis.annotations.Param;
@ -9,7 +10,7 @@ import java.util.List;
public interface RoleMapperEx {
List<Role> selectByConditionRole(
List<RoleEx> selectByConditionRole(
@Param("name") String name,
@Param("offset") Integer offset,
@Param("rows") Integer rows);

View File

@ -3,6 +3,7 @@ package com.jsh.erp.service.role;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.Role;
import com.jsh.erp.datasource.entities.RoleEx;
import com.jsh.erp.datasource.entities.RoleExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.RoleMapper;
@ -73,10 +74,19 @@ public class RoleService {
return list;
}
public List<Role> select(String name, int offset, int rows)throws Exception {
List<Role> list=null;
public List<RoleEx> select(String name, int offset, int rows)throws Exception {
List<RoleEx> list=null;
try{
list=roleMapperEx.selectByConditionRole(name, offset, rows);
for(RoleEx roleEx: list) {
String priceLimit = roleEx.getPriceLimit();
if(StringUtil.isNotEmpty(priceLimit)) {
String priceLimitStr = priceLimit.replace("1", "屏蔽采购价")
.replace("2", "屏蔽零售价")
.replace("3", "屏蔽销售价");
roleEx.setPriceLimitStr(priceLimitStr);
}
}
}catch(Exception e){
JshException.readFail(logger, e);
}

View File

@ -5,6 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="price_limit" jdbcType="VARCHAR" property="priceLimit" />
<result column="value" jdbcType="VARCHAR" property="value" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="enabled" jdbcType="BIT" property="enabled" />
@ -71,7 +72,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, name, type, value, description, enabled, sort, tenant_id, delete_flag
id, name, type, price_limit, value, description, enabled, sort, tenant_id, delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.RoleExample" resultMap="BaseResultMap">
select
@ -105,13 +106,13 @@
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.Role">
insert into jsh_role (id, name, type,
value, description, enabled,
sort, tenant_id, delete_flag
)
price_limit, value, description,
enabled, sort, tenant_id,
delete_flag)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{value,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{enabled,jdbcType=BIT},
#{sort,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
)
#{priceLimit,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{enabled,jdbcType=BIT}, #{sort,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT},
#{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Role">
insert into jsh_role
@ -125,6 +126,9 @@
<if test="type != null">
type,
</if>
<if test="priceLimit != null">
price_limit,
</if>
<if test="value != null">
value,
</if>
@ -154,6 +158,9 @@
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="priceLimit != null">
#{priceLimit,jdbcType=VARCHAR},
</if>
<if test="value != null">
#{value,jdbcType=VARCHAR},
</if>
@ -192,6 +199,9 @@
<if test="record.type != null">
type = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.priceLimit != null">
price_limit = #{record.priceLimit,jdbcType=VARCHAR},
</if>
<if test="record.value != null">
value = #{record.value,jdbcType=VARCHAR},
</if>
@ -220,6 +230,7 @@
set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR},
type = #{record.type,jdbcType=VARCHAR},
price_limit = #{record.priceLimit,jdbcType=VARCHAR},
value = #{record.value,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
enabled = #{record.enabled,jdbcType=BIT},
@ -239,6 +250,9 @@
<if test="type != null">
type = #{type,jdbcType=VARCHAR},
</if>
<if test="priceLimit != null">
price_limit = #{priceLimit,jdbcType=VARCHAR},
</if>
<if test="value != null">
value = #{value,jdbcType=VARCHAR},
</if>
@ -264,6 +278,7 @@
update jsh_role
set name = #{name,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR},
price_limit = #{priceLimit,jdbcType=VARCHAR},
value = #{value,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
enabled = #{enabled,jdbcType=BIT},

View File

@ -1,7 +1,9 @@
<?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.jsh.erp.datasource.mappers.RoleMapperEx">
<select id="selectByConditionRole" resultMap="com.jsh.erp.datasource.mappers.RoleMapper.BaseResultMap">
<resultMap extends="com.jsh.erp.datasource.mappers.RoleMapper.BaseResultMap" id="ResultExMap" type="com.jsh.erp.datasource.entities.RoleEx">
</resultMap>
<select id="selectByConditionRole" parameterType="com.jsh.erp.datasource.entities.RoleExample" resultMap="ResultExMap">
SELECT *
FROM jsh_role
WHERE 1=1