给客户、供应商、会员增加创建人字段,并进行权限控制

This commit is contained in:
季圣华 2023-06-21 19:42:02 +08:00
parent 1b7379fde9
commit fae5e6970b
9 changed files with 138 additions and 24 deletions

View File

@ -10,7 +10,7 @@ Target Server Type : MYSQL
Target Server Version : 50704
File Encoding : 65001
Date: 2023-05-28 22:28:31
Date: 2023-06-21 19:00:09
*/
SET FOREIGN_KEY_CHECKS=0;
@ -702,7 +702,7 @@ CREATE TABLE `jsh_platform_config` (
`platform_key_info` varchar(100) DEFAULT NULL COMMENT '关键词名称',
`platform_value` varchar(200) DEFAULT NULL COMMENT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COMMENT='平台参数';
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COMMENT='平台参数';
-- ----------------------------
-- Records of jsh_platform_config
@ -725,7 +725,6 @@ INSERT INTO `jsh_platform_config` VALUES ('15', 'aliOss_accessKeySecret', '阿
INSERT INTO `jsh_platform_config` VALUES ('16', 'aliOss_bucketName', '阿里OSS-bucketName', '');
INSERT INTO `jsh_platform_config` VALUES ('17', 'aliOss_linkUrl', '阿里OSS-linkUrl', '');
-- ----------------------------
-- Table structure for jsh_role
-- ----------------------------
@ -827,6 +826,7 @@ CREATE TABLE `jsh_supplier` (
`account_number` varchar(50) DEFAULT NULL COMMENT '账号',
`tax_rate` decimal(24,6) DEFAULT NULL COMMENT '税率',
`sort` varchar(10) DEFAULT NULL COMMENT '排序',
`creator` bigint(20) DEFAULT NULL COMMENT '操作员',
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户id',
`delete_flag` varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除',
PRIMARY KEY (`id`)
@ -835,13 +835,13 @@ CREATE TABLE `jsh_supplier` (
-- ----------------------------
-- Records of jsh_supplier
-- ----------------------------
INSERT INTO `jsh_supplier` VALUES ('57', '供应商1', '小军', '12345678', '', '', null, '供应商', '', '0.000000', '0.000000', '0.000000', '0.000000', '4.000000', '', '15000000000', '地址1', '', '', '', '12.000000', null, '63', '0');
INSERT INTO `jsh_supplier` VALUES ('58', '客户1', '小李', '12345678', '', '', null, '客户', '', '0.000000', '0.000000', '0.000000', '-100.000000', null, '', '', '', '', '', '', '12.000000', null, '63', '0');
INSERT INTO `jsh_supplier` VALUES ('59', '客户2', '小陈', '', '', '', null, '客户', '', '0.000000', '0.000000', '0.000000', '0.000000', null, '', '', '', '', '', '', null, null, '63', '0');
INSERT INTO `jsh_supplier` VALUES ('60', '12312666', '小曹', '', '', '', null, '会员', '', '970.000000', '0.000000', '0.000000', null, null, '', '13000000000', '', '', '', '', null, null, '63', '0');
INSERT INTO `jsh_supplier` VALUES ('68', '供应商3', '晓丽', '12345678', '', 'fasdfadf', null, '供应商', '', '0.000000', '0.000000', '0.000000', '0.000000', '-35.000000', '', '13000000000', 'aaaa', '1341324', '', '', '13.000000', null, '63', '0');
INSERT INTO `jsh_supplier` VALUES ('71', '客户3', '小周', '', '', '', null, '客户', '', '0.000000', '0.000000', '0.000000', '0.000000', null, '', '', '', '', '', '', null, null, '63', '0');
INSERT INTO `jsh_supplier` VALUES ('74', '供应商5', '小季', '77779999', '', '', null, '供应商', '', '0.000000', '0.000000', '5.000000', '0.000000', '5.000000', '', '15806283912', '', '', '', '', '3.000000', null, '63', '0');
INSERT INTO `jsh_supplier` VALUES ('57', '供应商1', '小军', '12345678', '', '', null, '供应商', '', '0.000000', '0.000000', '0.000000', '0.000000', '4.000000', '', '15000000000', '地址1', '', '', '', '12.000000', null, '63', '63', '0');
INSERT INTO `jsh_supplier` VALUES ('58', '客户1', '小李', '12345678', '', '', null, '客户', '', '0.000000', '0.000000', '0.000000', '-100.000000', null, '', '', '', '', '', '', '12.000000', null, '63', '63', '0');
INSERT INTO `jsh_supplier` VALUES ('59', '客户2', '小陈', '', '', '', null, '客户', '', '0.000000', '0.000000', '0.000000', '0.000000', null, '', '', '', '', '', '', null, null, '63', '63', '0');
INSERT INTO `jsh_supplier` VALUES ('60', '12312666', '小曹', '', '', '', null, '会员', '', '970.000000', '0.000000', '0.000000', null, null, '', '13000000000', '', '', '', '', null, null, '63', '63', '0');
INSERT INTO `jsh_supplier` VALUES ('68', '供应商3', '晓丽', '12345678', '', 'fasdfadf', null, '供应商', '', '0.000000', '0.000000', '0.000000', '0.000000', '-35.000000', '', '13000000000', 'aaaa', '1341324', '', '', '13.000000', null, '63', '63', '0');
INSERT INTO `jsh_supplier` VALUES ('71', '客户3', '小周', '', '', '', null, '客户', '', '0.000000', '0.000000', '0.000000', '0.000000', null, '', '', '', '', '', '', null, null, '63', '63', '0');
INSERT INTO `jsh_supplier` VALUES ('74', '供应商5', '小季', '77779999', '', '', null, '供应商', '', '0.000000', '0.000000', '5.000000', '0.000000', '5.000000', '', '15806283912', '', '', '', '', '3.000000', null, '63', '63', '0');
-- ----------------------------
-- Table structure for jsh_system_config

View File

@ -1509,4 +1509,12 @@ INSERT INTO `jsh_platform_config` (`platform_key`, `platform_key_info`, `platfor
INSERT INTO `jsh_platform_config` (`platform_key`, `platform_key_info`, `platform_value`) VALUES ('aliOss_accessKeyId', '阿里OSS-accessKeyId', '');
INSERT INTO `jsh_platform_config` (`platform_key`, `platform_key_info`, `platform_value`) VALUES ('aliOss_accessKeySecret', '阿里OSS-accessKeySecret', '');
INSERT INTO `jsh_platform_config` (`platform_key`, `platform_key_info`, `platform_value`) VALUES ('aliOss_bucketName', '阿里OSS-bucketName', '');
INSERT INTO `jsh_platform_config` (`platform_key`, `platform_key_info`, `platform_value`) VALUES ('aliOss_linkUrl', '阿里OSS-linkUrl', '');
INSERT INTO `jsh_platform_config` (`platform_key`, `platform_key_info`, `platform_value`) VALUES ('aliOss_linkUrl', '阿里OSS-linkUrl', '');
-- --------------------------------------------------------
-- 时间 2023年06月21日
-- by jishenghua
-- 给商家表增加操作员字段,并给该字段赋默认值
-- --------------------------------------------------------
alter table jsh_supplier add creator bigint(20) DEFAULT NULL COMMENT '操作员' after sort;
update jsh_supplier set creator=tenant_id;

View File

@ -47,6 +47,8 @@ public class Supplier {
private String sort;
private Long creator;
private Long tenantId;
private String deleteFlag;
@ -227,6 +229,14 @@ public class Supplier {
this.sort = sort == null ? null : sort.trim();
}
public Long getCreator() {
return creator;
}
public void setCreator(Long creator) {
this.creator = creator;
}
public Long getTenantId() {
return tenantId;
}

View File

@ -1555,6 +1555,66 @@ public class SupplierExample {
return (Criteria) this;
}
public Criteria andCreatorIsNull() {
addCriterion("creator is null");
return (Criteria) this;
}
public Criteria andCreatorIsNotNull() {
addCriterion("creator is not null");
return (Criteria) this;
}
public Criteria andCreatorEqualTo(Long value) {
addCriterion("creator =", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotEqualTo(Long value) {
addCriterion("creator <>", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThan(Long value) {
addCriterion("creator >", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThanOrEqualTo(Long value) {
addCriterion("creator >=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThan(Long value) {
addCriterion("creator <", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThanOrEqualTo(Long value) {
addCriterion("creator <=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorIn(List<Long> values) {
addCriterion("creator in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotIn(List<Long> values) {
addCriterion("creator not in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorBetween(Long value1, Long value2) {
addCriterion("creator between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotBetween(Long value1, Long value2) {
addCriterion("creator not between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andTenantIdIsNull() {
addCriterion("tenant_id is null");
return (Criteria) this;

View File

@ -14,6 +14,7 @@ public interface SupplierMapperEx {
@Param("type") String type,
@Param("phonenum") String phonenum,
@Param("telephone") String telephone,
@Param("creatorArray") String[] creatorArray,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
@ -21,7 +22,8 @@ public interface SupplierMapperEx {
@Param("supplier") String supplier,
@Param("type") String type,
@Param("phonenum") String phonenum,
@Param("telephone") String telephone);
@Param("telephone") String telephone,
@Param("creatorArray") String[] creatorArray);
List<Supplier> findByAll(
@Param("supplier") String supplier,

View File

@ -37,8 +37,8 @@ public class SupplierComponent implements ICommonQuery {
String type = StringUtil.getInfo(search, "type");
String phonenum = StringUtil.getInfo(search, "phonenum");
String telephone = StringUtil.getInfo(search, "telephone");
String order = QueryUtils.order(map);
return supplierService.select(supplier, type, phonenum, telephone, QueryUtils.offset(map), QueryUtils.rows(map));
String roleType = StringUtil.getInfo(search, "roleType");
return supplierService.select(supplier, type, phonenum, telephone, roleType, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
@ -48,7 +48,8 @@ public class SupplierComponent implements ICommonQuery {
String type = StringUtil.getInfo(search, "type");
String phonenum = StringUtil.getInfo(search, "phonenum");
String telephone = StringUtil.getInfo(search, "telephone");
return supplierService.countSupplier(supplier, type, phonenum, telephone);
String roleType = StringUtil.getInfo(search, "roleType");
return supplierService.countSupplier(supplier, type, phonenum, telephone, roleType);
}
@Override

View File

@ -98,10 +98,11 @@ public class SupplierService {
return list;
}
public List<Supplier> select(String supplier, String type, String phonenum, String telephone, int offset, int rows) throws Exception{
public List<Supplier> select(String supplier, String type, String phonenum, String telephone, String roleType, int offset, int rows) throws Exception{
List<Supplier> resList = new ArrayList<Supplier>();
try{
List<Supplier> list = supplierMapperEx.selectByConditionSupplier(supplier, type, phonenum, telephone, offset, rows);
String [] creatorArray = depotHeadService.getCreatorArray(roleType);
List<Supplier> list = supplierMapperEx.selectByConditionSupplier(supplier, type, phonenum, telephone, creatorArray, offset, rows);
for(Supplier s : list) {
Integer supplierId = s.getId().intValue();
String beginTime = Tools.getYearBegin();
@ -153,10 +154,11 @@ public class SupplierService {
return resList;
}
public Long countSupplier(String supplier, String type, String phonenum, String telephone) throws Exception{
public Long countSupplier(String supplier, String type, String phonenum, String telephone, String roleType) throws Exception{
Long result=null;
try{
result=supplierMapperEx.countsBySupplier(supplier, type, phonenum, telephone);
String [] creatorArray = depotHeadService.getCreatorArray(roleType);
result=supplierMapperEx.countsBySupplier(supplier, type, phonenum, telephone, creatorArray);
}catch(Exception e){
JshException.readFail(logger, e);
}
@ -169,6 +171,8 @@ public class SupplierService {
int result=0;
try{
supplier.setEnabled(true);
User userInfo=userService.getCurrentUser();
supplier.setCreator(userInfo==null?null:userInfo.getId());
result=supplierMapper.insertSelective(supplier);
//新增客户时给当前用户自动授权
if("客户".equals(supplier.getType())) {

View File

@ -24,6 +24,7 @@
<result column="account_number" jdbcType="VARCHAR" property="accountNumber" />
<result column="tax_rate" jdbcType="DECIMAL" property="taxRate" />
<result column="sort" jdbcType="VARCHAR" property="sort" />
<result column="creator" jdbcType="BIGINT" property="creator" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
</resultMap>
@ -88,7 +89,7 @@
<sql id="Base_Column_List">
id, supplier, contacts, phone_num, email, description, isystem, type, enabled, advance_in,
begin_need_get, begin_need_pay, all_need_get, all_need_pay, fax, telephone, address,
tax_num, bank_name, account_number, tax_rate, sort, tenant_id, delete_flag
tax_num, bank_name, account_number, tax_rate, sort, creator, tenant_id, delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.SupplierExample" resultMap="BaseResultMap">
select
@ -128,8 +129,8 @@
all_need_get, all_need_pay, fax,
telephone, address, tax_num,
bank_name, account_number, tax_rate,
sort, tenant_id, delete_flag
)
sort, creator, tenant_id,
delete_flag)
values (#{id,jdbcType=BIGINT}, #{supplier,jdbcType=VARCHAR}, #{contacts,jdbcType=VARCHAR},
#{phoneNum,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{isystem,jdbcType=TINYINT}, #{type,jdbcType=VARCHAR}, #{enabled,jdbcType=BIT},
@ -137,8 +138,8 @@
#{allNeedGet,jdbcType=DECIMAL}, #{allNeedPay,jdbcType=DECIMAL}, #{fax,jdbcType=VARCHAR},
#{telephone,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{taxNum,jdbcType=VARCHAR},
#{bankName,jdbcType=VARCHAR}, #{accountNumber,jdbcType=VARCHAR}, #{taxRate,jdbcType=DECIMAL},
#{sort,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
)
#{sort,jdbcType=VARCHAR}, #{creator,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT},
#{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Supplier">
insert into jsh_supplier
@ -209,6 +210,9 @@
<if test="sort != null">
sort,
</if>
<if test="creator != null">
creator,
</if>
<if test="tenantId != null">
tenant_id,
</if>
@ -283,6 +287,9 @@
<if test="sort != null">
#{sort,jdbcType=VARCHAR},
</if>
<if test="creator != null">
#{creator,jdbcType=BIGINT},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
@ -366,6 +373,9 @@
<if test="record.sort != null">
sort = #{record.sort,jdbcType=VARCHAR},
</if>
<if test="record.creator != null">
creator = #{record.creator,jdbcType=BIGINT},
</if>
<if test="record.tenantId != null">
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
@ -401,6 +411,7 @@
account_number = #{record.accountNumber,jdbcType=VARCHAR},
tax_rate = #{record.taxRate,jdbcType=DECIMAL},
sort = #{record.sort,jdbcType=VARCHAR},
creator = #{record.creator,jdbcType=BIGINT},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
@ -473,6 +484,9 @@
<if test="sort != null">
sort = #{sort,jdbcType=VARCHAR},
</if>
<if test="creator != null">
creator = #{creator,jdbcType=BIGINT},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
@ -505,6 +519,7 @@
account_number = #{accountNumber,jdbcType=VARCHAR},
tax_rate = #{taxRate,jdbcType=DECIMAL},
sort = #{sort,jdbcType=VARCHAR},
creator = #{creator,jdbcType=BIGINT},
tenant_id = #{tenantId,jdbcType=BIGINT},
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}

View File

@ -20,6 +20,13 @@
<bind name="bindTelephone" value="'%'+telephone+'%'"/>
and telephone like #{bindTelephone}
</if>
<if test="creatorArray != null">
and creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
</if>
and ifnull(delete_flag,'0') !='1'
order by sort asc, id desc
<if test="offset != null and rows != null">
@ -46,6 +53,13 @@
<bind name="bindTelephone" value="'%'+telephone+'%'"/>
and telephone like #{bindTelephone}
</if>
<if test="creatorArray != null">
and creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
</if>
and ifnull(delete_flag,'0') !='1'
</select>