优化用户和单据模块

This commit is contained in:
季圣华
2019-12-25 22:46:37 +08:00
parent 8cfdc3dc17
commit b9fb7e2c8c
10 changed files with 997 additions and 999 deletions

View File

@@ -161,7 +161,7 @@
<plugin> <plugin>
<groupId>org.mybatis.generator</groupId> <groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId> <artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version> <version>1.4.0</version>
<configuration> <configuration>
<configurationFile>${basedir}/src/test/resources/generatorConfig.xml</configurationFile> <configurationFile>${basedir}/src/test/resources/generatorConfig.xml</configurationFile>
<verbose>true</verbose> <verbose>true</verbose>

View File

@@ -13,7 +13,7 @@ public class DepotHeadExample {
protected List<Criteria> oredCriteria; protected List<Criteria> oredCriteria;
public DepotHeadExample() { public DepotHeadExample() {
oredCriteria = new ArrayList<Criteria>(); oredCriteria = new ArrayList<>();
} }
public void setOrderByClause(String orderByClause) { public void setOrderByClause(String orderByClause) {
@@ -70,7 +70,7 @@ public class DepotHeadExample {
protected GeneratedCriteria() { protected GeneratedCriteria() {
super(); super();
criteria = new ArrayList<Criterion>(); criteria = new ArrayList<>();
} }
public boolean isValid() { public boolean isValid() {
@@ -2118,7 +2118,6 @@ public class DepotHeadExample {
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
protected Criteria() { protected Criteria() {
super(); super();
} }

View File

@@ -11,7 +11,7 @@ public class UserExample {
protected List<Criteria> oredCriteria; protected List<Criteria> oredCriteria;
public UserExample() { public UserExample() {
oredCriteria = new ArrayList<Criteria>(); oredCriteria = new ArrayList<>();
} }
public void setOrderByClause(String orderByClause) { public void setOrderByClause(String orderByClause) {
@@ -68,7 +68,7 @@ public class UserExample {
protected GeneratedCriteria() { protected GeneratedCriteria() {
super(); super();
criteria = new ArrayList<Criterion>(); criteria = new ArrayList<>();
} }
public boolean isValid() { public boolean isValid() {
@@ -1036,7 +1036,6 @@ public class UserExample {
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
protected Criteria() { protected Criteria() {
super(); super();
} }

View File

@@ -6,7 +6,7 @@ import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
public interface DepotHeadMapper { public interface DepotHeadMapper {
int countByExample(DepotHeadExample example); long countByExample(DepotHeadExample example);
int deleteByExample(DepotHeadExample example); int deleteByExample(DepotHeadExample example);

View File

@@ -6,7 +6,7 @@ import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
public interface UserMapper { public interface UserMapper {
int countByExample(UserExample example); long countByExample(UserExample example);
int deleteByExample(UserExample example); int deleteByExample(UserExample example);

View File

@@ -464,8 +464,6 @@ public class DepotHeadService {
} }
/** /**
* create by: cjl
* description:
* 新增单据主表及单据子表信息 * 新增单据主表及单据子表信息
* create time: 2019/1/25 14:36 * create time: 2019/1/25 14:36
* @Param: beanJson * @Param: beanJson
@@ -493,15 +491,21 @@ public class DepotHeadService {
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
/**入库和出库处理预付款信息*/ /**入库和出库处理预付款信息*/
if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPaytype())){ if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPaytype())){
if(depotHead.getOrganid()!=null) { if(depotHead.getOrganid()!=null) {
supplierService.updateAdvanceIn(depotHead.getOrganid(), BigDecimal.ZERO.subtract(depotHead.getTotalprice())); supplierService.updateAdvanceIn(depotHead.getOrganid(), BigDecimal.ZERO.subtract(depotHead.getTotalprice()));
} }
} }
/**入库和出库处理单据子表信息*/ //根据单据编号查询单据id
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId, request); DepotHeadExample dhExample = new DepotHeadExample();
dhExample.createCriteria().andDefaultnumberEqualTo(depotHead.getDefaultnumber()).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<DepotHead> list = depotHeadMapper.selectByExample(dhExample);
if(list!=null) {
Long headId = list.get(0).getId();
/**入库和出库处理单据子表信息*/
depotItemService.saveDetials(inserted,deleted,updated,headId,tenantId, request);
}
/**如果关联单据号非空则更新订单的状态为2 */ /**如果关联单据号非空则更新订单的状态为2 */
if(depotHead.getLinknumber()!=null) { if(depotHead.getLinknumber()!=null) {
DepotHead depotHeadOrders = new DepotHead(); DepotHead depotHeadOrders = new DepotHead();
@@ -516,8 +520,6 @@ public class DepotHeadService {
} }
} }
/** /**
* create by: cjl
* description:
* 更新单据主表及单据子表信息 * 更新单据主表及单据子表信息
* create time: 2019/1/28 14:47 * create time: 2019/1/28 14:47
* @Param: id * @Param: id

View File

@@ -334,8 +334,14 @@ public class UserService {
OrgaUserRel oul=new OrgaUserRel(); OrgaUserRel oul=new OrgaUserRel();
//机构id //机构id
oul.setOrgaId(ue.getOrgaId()); oul.setOrgaId(ue.getOrgaId());
//用户id //用户id根据用户名查询id
oul.setUserId(ue.getId()); UserExample example = new UserExample();
example.createCriteria().andLoginameEqualTo(ue.getLoginame());
List<User> list = userMapper.selectByExample(example);
if(list!=null) {
Long userId = list.get(0).getId();
oul.setUserId(userId);
}
//用户在机构中的排序 //用户在机构中的排序
oul.setUserBlngOrgaDsplSeq(ue.getUserBlngOrgaDsplSeq()); oul.setUserBlngOrgaDsplSeq(ue.getUserBlngOrgaDsplSeq());

View File

@@ -130,9 +130,6 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.DepotHead"> <insert id="insert" parameterType="com.jsh.erp.datasource.entities.DepotHead">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into jsh_depothead (Id, Type, SubType, insert into jsh_depothead (Id, Type, SubType,
ProjectId, DefaultNumber, Number, ProjectId, DefaultNumber, Number,
OperPersonName, CreateTime, OperTime, OperPersonName, CreateTime, OperTime,
@@ -157,12 +154,11 @@
#{deleteFlag,jdbcType=VARCHAR}) #{deleteFlag,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotHead"> <insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotHead">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into jsh_depothead insert into jsh_depothead
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
Id, <if test="id != null">
Id,
</if>
<if test="type != null"> <if test="type != null">
Type, Type,
</if> </if>
@@ -255,7 +251,9 @@
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT}, <if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="type != null"> <if test="type != null">
#{type,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
</if> </if>
@@ -348,7 +346,7 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultType="java.lang.Integer"> <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultType="java.lang.Long">
select count(*) from jsh_depothead select count(*) from jsh_depothead
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />

View File

@@ -110,9 +110,6 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.User"> <insert id="insert" parameterType="com.jsh.erp.datasource.entities.User">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into jsh_user (id, username, loginame, insert into jsh_user (id, username, loginame,
password, position, department, password, position, department,
email, phonenum, ismanager, email, phonenum, ismanager,
@@ -125,12 +122,11 @@
#{remark,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}) #{remark,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT})
</insert> </insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.User"> <insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.User">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into jsh_user insert into jsh_user
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
id, <if test="id != null">
id,
</if>
<if test="username != null"> <if test="username != null">
username, username,
</if> </if>
@@ -172,7 +168,9 @@
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT}, <if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="username != null"> <if test="username != null">
#{username,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR},
</if> </if>
@@ -214,7 +212,7 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.UserExample" resultType="java.lang.Integer"> <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.UserExample" resultType="java.lang.Long">
select count(*) from jsh_user select count(*) from jsh_user
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />

View File

@@ -37,7 +37,7 @@
<!-- generate Mapper --> <!-- generate Mapper -->
<javaClientGenerator type="XMLMAPPER" <javaClientGenerator type="XMLMAPPER"
targetPackage="com.jsh.erp.datasource.mappers" targetPackage="com.jsh.erp.datasource.mappers"
targetProject="src\main\java" implementationPackage=""> targetProject="src\main\java">
<property name="enableSubPackages" value="false"/> <property name="enableSubPackages" value="false"/>
<property name="exampleMethodVisibility" value="public"/> <property name="exampleMethodVisibility" value="public"/>
</javaClientGenerator> </javaClientGenerator>
@@ -45,9 +45,7 @@
<table tableName="jsh_accounthead" domainObjectName="AccountHead"></table> <table tableName="jsh_accounthead" domainObjectName="AccountHead"></table>
<table tableName="jsh_accountitem" domainObjectName="AccountItem"></table> <table tableName="jsh_accountitem" domainObjectName="AccountItem"></table>
<table tableName="jsh_depot" domainObjectName="Depot"></table> <table tableName="jsh_depot" domainObjectName="Depot"></table>
<table tableName="jsh_depothead" domainObjectName="DepotHead"> <table tableName="jsh_depothead" domainObjectName="DepotHead"></table>
<generatedKey column="id" sqlStatement="SELECT LAST_INSERT_ID()"/>
</table>
<table tableName="jsh_depotitem" domainObjectName="DepotItem"></table> <table tableName="jsh_depotitem" domainObjectName="DepotItem"></table>
<table tableName="jsh_functions" domainObjectName="Functions"></table> <table tableName="jsh_functions" domainObjectName="Functions"></table>
<table tableName="jsh_inoutitem" domainObjectName="InOutItem"></table> <table tableName="jsh_inoutitem" domainObjectName="InOutItem"></table>
@@ -61,9 +59,7 @@
<table tableName="jsh_supplier" domainObjectName="Supplier"></table> <table tableName="jsh_supplier" domainObjectName="Supplier"></table>
<table tableName="jsh_systemconfig" domainObjectName="SystemConfig"></table> <table tableName="jsh_systemconfig" domainObjectName="SystemConfig"></table>
<table tableName="jsh_unit" domainObjectName="Unit"></table> <table tableName="jsh_unit" domainObjectName="Unit"></table>
<table tableName="jsh_user" domainObjectName="User"> <table tableName="jsh_user" domainObjectName="User"></table>
<generatedKey column="id" sqlStatement="SELECT LAST_INSERT_ID()"/>
</table>
<table tableName="jsh_userbusiness" domainObjectName="UserBusiness"></table> <table tableName="jsh_userbusiness" domainObjectName="UserBusiness"></table>
<table tableName="jsh_serial_number" domainObjectName="SerialNumber"></table> <table tableName="jsh_serial_number" domainObjectName="SerialNumber"></table>
<table tableName="jsh_organization" domainObjectName="Organization"></table> <table tableName="jsh_organization" domainObjectName="Organization"></table>