Commit 1c47666c4f2db367cc88e608548f27bd01031dc7

Authored by baohanddd
1 parent 39d5d99879

add data import :机构、部门、用户(医生)

Showing 14 changed files with 761 additions and 531 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/model/Departments.java View file @ 1c47666
1 1 package com.lyms.platform.permission.model;
2 2  
3 3 import java.util.Date;
  4 +import java.util.HashMap;
  5 +import java.util.List;
  6 +import java.util.Map;
4 7  
5 8 public class Departments {
6 9 private Integer id;
... ... @@ -15,6 +18,25 @@
15 18 private Date created;
16 19 private Integer type;
17 20 private String shortCode;
  21 + private String foreignId;
  22 +
  23 + Map<String, Users> usersMap = new HashMap<>();
  24 +
  25 + public Map<String, Users> getUsersMap() {
  26 + return usersMap;
  27 + }
  28 +
  29 + public void setUsersMap(Map<String, Users> usersMap) {
  30 + this.usersMap = usersMap;
  31 + }
  32 +
  33 + public String getForeignId() {
  34 + return foreignId;
  35 + }
  36 +
  37 + public void setForeignId(String foreignId) {
  38 + this.foreignId = foreignId;
  39 + }
18 40  
19 41 private Organization organization;
20 42  
platform-biz-service/src/main/java/com/lyms/platform/permission/model/DepartmentsQuery.java View file @ 1c47666
... ... @@ -20,6 +20,15 @@
20 20 private Integer type;
21 21 private String shortCode;
22 22 private String keyword;
  23 + private String foreignId;
  24 +
  25 + public String getForeignId() {
  26 + return foreignId;
  27 + }
  28 +
  29 + public void setForeignId(String foreignId) {
  30 + this.foreignId = foreignId;
  31 + }
23 32  
24 33 public String getShortCode() {
25 34 return shortCode;
platform-biz-service/src/main/java/com/lyms/platform/permission/model/Organization.java View file @ 1c47666
... ... @@ -4,6 +4,9 @@
4 4 import com.lyms.platform.pojo.BasicConfig;
5 5  
6 6 import java.util.Date;
  7 +import java.util.HashMap;
  8 +import java.util.List;
  9 +import java.util.Map;
7 10  
8 11 public class Organization {
9 12 private Integer id;
... ... @@ -29,6 +32,16 @@
29 32 private BasicConfig city;
30 33 private BasicConfig area;
31 34 private String foreignId;
  35 +
  36 + Map<String, Departments> departmentsMap = new HashMap<>();
  37 +
  38 + public Map<String, Departments> getDepartmentsMap() {
  39 + return departmentsMap;
  40 + }
  41 +
  42 + public void setDepartmentsMap(Map<String, Departments> departmentsMap) {
  43 + this.departmentsMap = departmentsMap;
  44 + }
32 45  
33 46 public String getForeignId() {
34 47 return foreignId;
platform-biz-service/src/main/java/com/lyms/platform/permission/model/OrganizationQuery.java View file @ 1c47666
... ... @@ -24,6 +24,15 @@
24 24 private Date created;
25 25 private String shortCode;
26 26 private String keyword;
  27 + private String foreignId;
  28 +
  29 + public String getForeignId() {
  30 + return foreignId;
  31 + }
  32 +
  33 + public void setForeignId(String foreignId) {
  34 + this.foreignId = foreignId;
  35 + }
27 36  
28 37 public String getShortCode() {
29 38 return shortCode;
platform-biz-service/src/main/java/com/lyms/platform/permission/model/Users.java View file @ 1c47666
... ... @@ -27,6 +27,15 @@
27 27 private List<Roles> roles;
28 28 private Departments departmentses;
29 29 private Organization organization;
  30 + private String foreignId;
  31 +
  32 + public String getForeignId() {
  33 + return foreignId;
  34 + }
  35 +
  36 + public void setForeignId(String foreignId) {
  37 + this.foreignId = foreignId;
  38 + }
30 39  
31 40  
32 41 public Integer getKsId() {
platform-biz-service/src/main/java/com/lyms/platform/permission/model/UsersQuery.java View file @ 1c47666
... ... @@ -28,6 +28,15 @@
28 28  
29 29 private String keyword;
30 30 private Integer roleId;
  31 + private String foreignId;
  32 +
  33 + public String getForeignId() {
  34 + return foreignId;
  35 + }
  36 +
  37 + public void setForeignId(String foreignId) {
  38 + this.foreignId = foreignId;
  39 + }
31 40  
32 41 public Integer getRoleId() {
33 42 return roleId;
platform-biz-service/src/main/resources/mainOrm/Departments.xml View file @ 1c47666
... ... @@ -2,152 +2,157 @@
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3 3 <mapper namespace="com.lyms.platform.permission.dao.DepartmentsMapper">
4 4  
5   -<resultMap id="DepartmentsResultMap" type="com.lyms.platform.permission.model.Departments">
6   -<id column="id" property="id" jdbcType="INTEGER" />
7   -<result column="parent_id" property="parentId" jdbcType="INTEGER" />
8   -<result column="name" property="name" jdbcType="VARCHAR" />
9   -<result column="org_id" property="orgId" jdbcType="INTEGER" />
10   -<result column="description" property="description" jdbcType="VARCHAR" />
11   -<result column="publish_id" property="publishId" jdbcType="INTEGER" />
12   -<result column="publish_name" property="publishName" jdbcType="VARCHAR" />
13   -<result column="yn" property="yn" jdbcType="INTEGER" />
14   -<result column="modified" property="modified" jdbcType="TIMESTAMP" />
15   -<result column="created" property="created" jdbcType="TIMESTAMP" />
16   -<result column="type" property="type" jdbcType="INTEGER" />
17   -<result column="shortCode" property="shortCode" jdbcType="VARCHAR" />
18   -</resultMap>
  5 + <resultMap id="DepartmentsResultMap" type="com.lyms.platform.permission.model.Departments">
  6 + <id column="id" property="id" jdbcType="INTEGER"/>
  7 + <result column="parent_id" property="parentId" jdbcType="INTEGER"/>
  8 + <result column="name" property="name" jdbcType="VARCHAR"/>
  9 + <result column="org_id" property="orgId" jdbcType="INTEGER"/>
  10 + <result column="description" property="description" jdbcType="VARCHAR"/>
  11 + <result column="publish_id" property="publishId" jdbcType="INTEGER"/>
  12 + <result column="publish_name" property="publishName" jdbcType="VARCHAR"/>
  13 + <result column="yn" property="yn" jdbcType="INTEGER"/>
  14 + <result column="modified" property="modified" jdbcType="TIMESTAMP"/>
  15 + <result column="created" property="created" jdbcType="TIMESTAMP"/>
  16 + <result column="type" property="type" jdbcType="INTEGER"/>
  17 + <result column="shortCode" property="shortCode" jdbcType="VARCHAR"/>
  18 + <result column="foreign_id" property="foreignId" jdbcType="VARCHAR"/>
  19 + </resultMap>
19 20  
20 21  
21   -
22   -<insert id="addDepartments" parameterType="com.lyms.platform.permission.model.Departments">
23   -insert into departments (parent_id,name,org_id,description,publish_id,publish_name,yn,modified,created,type,shortCode) values (#{parentId},#{name},#{orgId},#{description},#{publishId},#{publishName},#{yn},#{modified},#{created},#{type},#{shortCode})
  22 + <insert id="addDepartments" parameterType="com.lyms.platform.permission.model.Departments">
  23 + <selectKey order="AFTER" keyProperty="id" resultType="java.lang.Integer"> SELECT LAST_INSERT_ID() </selectKey>
  24 +insert into departments (foreign_id,parent_id,name,org_id,description,publish_id,publish_name,yn,modified,created,type,shortCode) values (#{foreignId},#{parentId},#{name},#{orgId},#{description},#{publishId},#{publishName},#{yn},#{modified},#{created},#{type},#{shortCode})
24 25 </insert>
25 26  
26 27  
  28 + <update id="updateDepartments" parameterType="com.lyms.platform.permission.model.Departments">
  29 + update departments
  30 + <set>
  31 + <if test="parentId != null and parentId >= 0">
  32 + parent_id = #{parentId,jdbcType=INTEGER},
  33 + </if>
  34 + <if test="name != null and name != ''">
  35 + name = #{name,jdbcType=VARCHAR},
  36 + </if>
  37 + <if test="orgId != null and orgId >= 0">
  38 + org_id = #{orgId,jdbcType=INTEGER},
  39 + </if>
  40 + <if test="foreignId != null and foreignId != ''">
  41 + foreign_id = #{foreignId,jdbcType=INTEGER},
  42 + </if>
  43 + <if test="description != null and description != ''">
  44 + description = #{description,jdbcType=VARCHAR},
  45 + </if>
  46 + <if test="publishId != null and publishId >= 0">
  47 + publish_id = #{publishId,jdbcType=INTEGER},
  48 + </if>
  49 + <if test="publishName != null and publishName != ''">
  50 + publish_name = #{publishName,jdbcType=VARCHAR},
  51 + </if>
  52 + <if test="yn != null and yn >= 0">
  53 + yn = #{yn,jdbcType=INTEGER},
  54 + </if>
  55 + <if test="modified != null">
  56 + modified = #{modified,jdbcType=TIMESTAMP},
  57 + </if>
  58 + <if test="created != null">
  59 + created = #{created,jdbcType=TIMESTAMP},
  60 + </if>
  61 + <if test="type != null and type >= 0">
  62 + type = #{type,jdbcType=INTEGER},
  63 + </if>
  64 + <if test="shortCode != null and shortCode != ''">
  65 + shortCode = #{shortCode,jdbcType=VARCHAR},
  66 + </if>
  67 + </set>
  68 + where id = #{id,jdbcType=INTEGER}
  69 + </update>
27 70  
28   -<update id="updateDepartments" parameterType="com.lyms.platform.permission.model.Departments">
29   -update departments <set><if test="parentId != null and parentId >= 0">
30   -parent_id = #{parentId,jdbcType=INTEGER},
31   -</if>
32   -<if test="name != null and name != ''">
33   -name = #{name,jdbcType=VARCHAR},
34   -</if>
35   -<if test="orgId != null and orgId >= 0">
36   -org_id = #{orgId,jdbcType=INTEGER},
37   -</if>
38   -<if test="description != null and description != ''">
39   -description = #{description,jdbcType=VARCHAR},
40   -</if>
41   -<if test="publishId != null and publishId >= 0">
42   -publish_id = #{publishId,jdbcType=INTEGER},
43   -</if>
44   -<if test="publishName != null and publishName != ''">
45   -publish_name = #{publishName,jdbcType=VARCHAR},
46   -</if>
47   -<if test="yn != null and yn >= 0">
48   -yn = #{yn,jdbcType=INTEGER},
49   -</if>
50   -<if test="modified != null">
51   -modified = #{modified,jdbcType=TIMESTAMP},
52   -</if>
53   -<if test="created != null">
54   -created = #{created,jdbcType=TIMESTAMP},
55   -</if>
56   -<if test="type != null and type >= 0">
57   -type = #{type,jdbcType=INTEGER},
58   -</if>
59   -<if test="shortCode != null and shortCode != ''">
60   -shortCode = #{shortCode,jdbcType=VARCHAR},
61   -</if>
62   -</set>
63   -where id = #{id,jdbcType=INTEGER}
64   -</update>
65 71  
66   -
67   -<delete id="deleteDepartments" parameterType="java.lang.Integer">
  72 + <delete id="deleteDepartments" parameterType="java.lang.Integer">
68 73 delete from departments where id = #{id,jdbcType=INTEGER}
69 74 </delete>
70 75  
71 76  
72   -
73   -<select id="getDepartments" resultMap="DepartmentsResultMap" parameterType="java.lang.Integer">
74   -select id,parent_id,name,org_id,description,publish_id,publish_name,yn,modified,created,type,shortCode
  77 + <select id="getDepartments" resultMap="DepartmentsResultMap" parameterType="java.lang.Integer">
  78 +select id,parent_id,name,org_id,description,publish_id,publish_name,yn,modified,created,type,shortCode,foreign_id
75 79 from departments where id = #{id,jdbcType=INTEGER}
76 80 </select>
77 81  
78 82  
79   -<sql id="orderAndLimit">
80   -<if test="sort != null and sort != '' ">
81   -order by ${sort}
82   -<if test="need != null">
83   -limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
84   -</if>
85   -</if>
86   -</sql>
  83 + <sql id="orderAndLimit">
  84 + <if test="sort != null and sort != '' ">
  85 + order by ${sort}
  86 + <if test="need != null">
  87 + limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
  88 + </if>
  89 + </if>
  90 + </sql>
87 91  
88 92  
  93 + <sql id="DepartmentsCondition">
  94 + <where>
  95 + 1 = 1
  96 + <if test="id != null and id >= 0">
  97 + and id = #{id,jdbcType=INTEGER}
  98 + </if>
  99 + <if test="parentId != null and parentId >= 0">
  100 + and parent_id = #{parentId,jdbcType=INTEGER}
  101 + </if>
  102 + <if test="foreignId != null and foreignId != ''">
  103 + and foreign_id = #{foreignId,jdbcType=VARCHAR}
  104 + </if>
  105 + <if test="name != null and name != ''">
  106 + and name = #{name,jdbcType=VARCHAR}
  107 + </if>
  108 + <if test="orgId != null and orgId >= 0">
  109 + and org_id = #{orgId,jdbcType=INTEGER}
  110 + </if>
  111 + <if test="description != null and description != ''">
  112 + and description = #{description,jdbcType=VARCHAR}
  113 + </if>
  114 + <if test="publishId != null and publishId >= 0">
  115 + and publish_id = #{publishId,jdbcType=INTEGER}
  116 + </if>
  117 + <if test="publishName != null and publishName != ''">
  118 + and publish_name = #{publishName,jdbcType=VARCHAR}
  119 + </if>
  120 + <if test="yn != null and yn >= 0">
  121 + and yn = #{yn,jdbcType=INTEGER}
  122 + </if>
  123 + <if test="modified != null">
  124 + and modified = #{modified,jdbcType=TIMESTAMP}
  125 + </if>
  126 + <if test="created != null">
  127 + and created = #{created,jdbcType=TIMESTAMP}
  128 + </if>
  129 + <if test="type != null and type >= 0">
  130 + and type = #{type,jdbcType=INTEGER}
  131 + </if>
  132 + <if test="shortCode != null and shortCode != ''">
  133 + and shortCode = #{shortCode,jdbcType=VARCHAR}
  134 + </if>
  135 + <if test="keyword != null and keyword != ''">
  136 + and name like CONCAT(#{keyword}, '%')
  137 + </if>
  138 + </where>
  139 + </sql>
89 140  
90   -<sql id="DepartmentsCondition">
91   -<where>
92   - 1 = 1
93   -<if test="id != null and id >= 0">
94   -and id = #{id,jdbcType=INTEGER}
95   -</if>
96   -<if test="parentId != null and parentId >= 0">
97   -and parent_id = #{parentId,jdbcType=INTEGER}
98   -</if>
99   -<if test="name != null and name != ''">
100   -and name = #{name,jdbcType=VARCHAR}
101   -</if>
102   -<if test="orgId != null and orgId >= 0">
103   -and org_id = #{orgId,jdbcType=INTEGER}
104   -</if>
105   -<if test="description != null and description != ''">
106   -and description = #{description,jdbcType=VARCHAR}
107   -</if>
108   -<if test="publishId != null and publishId >= 0">
109   -and publish_id = #{publishId,jdbcType=INTEGER}
110   -</if>
111   -<if test="publishName != null and publishName != ''">
112   -and publish_name = #{publishName,jdbcType=VARCHAR}
113   -</if>
114   -<if test="yn != null and yn >= 0">
115   -and yn = #{yn,jdbcType=INTEGER}
116   -</if>
117   -<if test="modified != null">
118   -and modified = #{modified,jdbcType=TIMESTAMP}
119   -</if>
120   -<if test="created != null">
121   -and created = #{created,jdbcType=TIMESTAMP}
122   -</if>
123   -<if test="type != null and type >= 0">
124   -and type = #{type,jdbcType=INTEGER}
125   -</if>
126   -<if test="shortCode != null and shortCode != ''">
127   -and shortCode = #{shortCode,jdbcType=VARCHAR}
128   -</if>
129   - <if test="keyword != null and keyword != ''">
130   - and name like CONCAT(#{keyword}, '%')
131   - </if>
132   -</where>
133   -</sql>
134 141  
  142 + <select id="queryDepartments" resultMap="DepartmentsResultMap"
  143 + parameterType="com.lyms.platform.permission.model.DepartmentsQuery">
  144 + select id,parent_id,name,org_id,description,publish_id,publish_name,yn,modified,created,type,shortCode,foreign_id
  145 + from departments
  146 + <include refid="DepartmentsCondition"/>
  147 + <include refid="orderAndLimit"/>
  148 + </select>
135 149  
136 150  
137   -<select id="queryDepartments" resultMap="DepartmentsResultMap" parameterType="com.lyms.platform.permission.model.DepartmentsQuery">
138   -select id,parent_id,name,org_id,description,publish_id,publish_name,yn,modified,created,type,shortCode
139   - from departments
140   -<include refid="DepartmentsCondition" />
141   -<include refid="orderAndLimit" />
142   -</select>
143   -
144   -
145   -
146   -<select id="queryDepartmentsCount" resultType="int" parameterType="com.lyms.platform.permission.model.DepartmentsQuery">
147   -select count(1) from departments
148   -<include refid="DepartmentsCondition" />
149   -</select>
150   -
  151 + <select id="queryDepartmentsCount" resultType="int"
  152 + parameterType="com.lyms.platform.permission.model.DepartmentsQuery">
  153 + select count(1) from departments
  154 + <include refid="DepartmentsCondition"/>
  155 + </select>
151 156  
152 157  
153 158 </mapper>
platform-biz-service/src/main/resources/mainOrm/Organization.xml View file @ 1c47666
... ... @@ -2,180 +2,187 @@
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3 3 <mapper namespace="com.lyms.platform.permission.dao.OrganizationMapper">
4 4  
5   -<resultMap id="OrganizationResultMap" type="com.lyms.platform.permission.model.Organization">
6   -<id column="id" property="id" jdbcType="INTEGER" />
7   -<result column="name" property="name" jdbcType="VARCHAR" />
8   -<result column="type" property="type" jdbcType="INTEGER" />
9   -<result column="level" property="level" jdbcType="INTEGER" />
10   -<result column="area_manage" property="areaManage" jdbcType="INTEGER" />
11   -<result column="province_id" property="provinceId" jdbcType="INTEGER" />
12   -<result column="city_id" property="cityId" jdbcType="INTEGER" />
13   -<result column="area_id" property="areaId" jdbcType="INTEGER" />
14   -<result column="address" property="address" jdbcType="VARCHAR" />
15   -<result column="description" property="description" jdbcType="VARCHAR" />
16   -<result column="publish_id" property="publishId" jdbcType="INTEGER" />
17   -<result column="publish_name" property="publishName" jdbcType="VARCHAR" />
18   -<result column="yn" property="yn" jdbcType="INTEGER" />
19   -<result column="modified" property="modified" jdbcType="TIMESTAMP" />
20   -<result column="created" property="created" jdbcType="TIMESTAMP" />
21   -<result column="shortCode" property="shortCode" jdbcType="VARCHAR" />
22   -</resultMap>
  5 + <resultMap id="OrganizationResultMap" type="com.lyms.platform.permission.model.Organization">
  6 + <id column="id" property="id" jdbcType="INTEGER"/>
  7 + <result column="name" property="name" jdbcType="VARCHAR"/>
  8 + <result column="type" property="type" jdbcType="INTEGER"/>
  9 + <result column="level" property="level" jdbcType="INTEGER"/>
  10 + <result column="area_manage" property="areaManage" jdbcType="INTEGER"/>
  11 + <result column="province_id" property="provinceId" jdbcType="VARCHAR"/>
  12 + <result column="city_id" property="cityId" jdbcType="VARCHAR"/>
  13 + <result column="area_id" property="areaId" jdbcType="VARCHAR"/>
  14 + <result column="address" property="address" jdbcType="VARCHAR"/>
  15 + <result column="description" property="description" jdbcType="VARCHAR"/>
  16 + <result column="publish_id" property="publishId" jdbcType="INTEGER"/>
  17 + <result column="publish_name" property="publishName" jdbcType="VARCHAR"/>
  18 + <result column="yn" property="yn" jdbcType="INTEGER"/>
  19 + <result column="modified" property="modified" jdbcType="TIMESTAMP"/>
  20 + <result column="created" property="created" jdbcType="TIMESTAMP"/>
  21 + <result column="shortCode" property="shortCode" jdbcType="VARCHAR"/>
  22 + <result column="foreign_id" property="foreignId" jdbcType="VARCHAR"/>
  23 + </resultMap>
23 24  
24 25  
25   -
26   -<insert id="addOrganization" parameterType="com.lyms.platform.permission.model.Organization">
27   -insert into organization (name,type,level,area_manage,province_id,city_id,area_id,address,description,publish_id,publish_name,yn,modified,created,shortCode) values (#{name},#{type},#{level},#{areaManage},#{provinceId},#{cityId},#{areaId},#{address},#{description},#{publishId},#{publishName},#{yn},#{modified},#{created},#{shortCode})
  26 + <insert id="addOrganization" parameterType="com.lyms.platform.permission.model.Organization">
  27 + <selectKey order="AFTER" keyProperty="id" resultType="java.lang.Integer"> SELECT LAST_INSERT_ID() </selectKey>
  28 +insert into organization (foreign_id,name,type,level,area_manage,province_id,city_id,area_id,address,description,publish_id,publish_name,yn,modified,created,shortCode)
  29 +values (#{foreignId},#{name},#{type},#{level},#{areaManage},#{provinceId},#{cityId},#{areaId},#{address},#{description},#{publishId},#{publishName},#{yn},#{modified},#{created},#{shortCode})
28 30 </insert>
29 31  
30 32  
  33 + <update id="updateOrganization" parameterType="com.lyms.platform.permission.model.Organization">
  34 + update organization
  35 + <set>
  36 + <if test="foreignId != null and foreignId != ''">
  37 + foreign_id = #{foreignId,jdbcType=VARCHAR},
  38 + </if>
  39 + <if test="name != null and name != ''">
  40 + name = #{name,jdbcType=VARCHAR},
  41 + </if>
  42 + <if test="type != null and type >= 0">
  43 + type = #{type,jdbcType=INTEGER},
  44 + </if>
  45 + <if test="level != null and level >= 0">
  46 + level = #{level,jdbcType=INTEGER},
  47 + </if>
  48 + <if test="areaManage != null and areaManage >= 0">
  49 + area_manage = #{areaManage,jdbcType=INTEGER},
  50 + </if>
  51 + <if test="provinceId != null">
  52 + province_id = #{provinceId,jdbcType=INTEGER},
  53 + </if>
  54 + <if test="cityId != null">
  55 + city_id = #{cityId,jdbcType=INTEGER},
  56 + </if>
  57 + <if test="areaId != null">
  58 + area_id = #{areaId,jdbcType=INTEGER},
  59 + </if>
  60 + <if test="address != null and address != ''">
  61 + address = #{address,jdbcType=VARCHAR},
  62 + </if>
  63 + <if test="description != null and description != ''">
  64 + description = #{description,jdbcType=VARCHAR},
  65 + </if>
  66 + <if test="publishId != null and publishId >= 0">
  67 + publish_id = #{publishId,jdbcType=INTEGER},
  68 + </if>
  69 + <if test="publishName != null and publishName != ''">
  70 + publish_name = #{publishName,jdbcType=VARCHAR},
  71 + </if>
  72 + <if test="yn != null and yn >= 0">
  73 + yn = #{yn,jdbcType=INTEGER},
  74 + </if>
  75 + <if test="modified != null">
  76 + modified = #{modified,jdbcType=TIMESTAMP},
  77 + </if>
  78 + <if test="created != null">
  79 + created = #{created,jdbcType=TIMESTAMP},
  80 + </if>
  81 + <if test="shortCode != null and shortCode != ''">
  82 + shortCode = #{shortCode,jdbcType=VARCHAR},
  83 + </if>
  84 + </set>
  85 + where id = #{id,jdbcType=INTEGER}
  86 + </update>
31 87  
32   -<update id="updateOrganization" parameterType="com.lyms.platform.permission.model.Organization">
33   -update organization <set><if test="name != null and name != ''">
34   -name = #{name,jdbcType=VARCHAR},
35   -</if>
36   -<if test="type != null and type >= 0">
37   -type = #{type,jdbcType=INTEGER},
38   -</if>
39   -<if test="level != null and level >= 0">
40   -level = #{level,jdbcType=INTEGER},
41   -</if>
42   -<if test="areaManage != null and areaManage >= 0">
43   -area_manage = #{areaManage,jdbcType=INTEGER},
44   -</if>
45   -<if test="provinceId != null and provinceId >= 0">
46   -province_id = #{provinceId,jdbcType=INTEGER},
47   -</if>
48   -<if test="cityId != null and cityId >= 0">
49   -city_id = #{cityId,jdbcType=INTEGER},
50   -</if>
51   -<if test="areaId != null and areaId >= 0">
52   -area_id = #{areaId,jdbcType=INTEGER},
53   -</if>
54   -<if test="address != null and address != ''">
55   -address = #{address,jdbcType=VARCHAR},
56   -</if>
57   -<if test="description != null and description != ''">
58   -description = #{description,jdbcType=VARCHAR},
59   -</if>
60   -<if test="publishId != null and publishId >= 0">
61   -publish_id = #{publishId,jdbcType=INTEGER},
62   -</if>
63   -<if test="publishName != null and publishName != ''">
64   -publish_name = #{publishName,jdbcType=VARCHAR},
65   -</if>
66   -<if test="yn != null and yn >= 0">
67   -yn = #{yn,jdbcType=INTEGER},
68   -</if>
69   -<if test="modified != null">
70   -modified = #{modified,jdbcType=TIMESTAMP},
71   -</if>
72   -<if test="created != null">
73   -created = #{created,jdbcType=TIMESTAMP},
74   -</if>
75   -<if test="shortCode != null and shortCode != ''">
76   -shortCode = #{shortCode,jdbcType=VARCHAR},
77   -</if>
78   -</set>
79   -where id = #{id,jdbcType=INTEGER}
80   -</update>
81 88  
82   -
83   -<delete id="deleteOrganization" parameterType="java.lang.Integer">
  89 + <delete id="deleteOrganization" parameterType="java.lang.Integer">
84 90 delete from organization where id = #{id,jdbcType=INTEGER}
85 91 </delete>
86 92  
87 93  
88   -
89   -<select id="getOrganization" resultMap="OrganizationResultMap" parameterType="java.lang.Integer">
90   -select id,name,type,level,area_manage,province_id,city_id,area_id,address,description,publish_id,publish_name,yn,modified,created,shortCode
  94 + <select id="getOrganization" resultMap="OrganizationResultMap" parameterType="java.lang.Integer">
  95 +select id,name,type,level,area_manage,province_id,city_id,area_id,address,description,publish_id,publish_name,yn,modified,created,shortCode,foreign_id
91 96 from organization where id = #{id,jdbcType=INTEGER}
92 97 </select>
93 98  
94 99  
95   -<sql id="orderAndLimit">
96   -<if test="sort != null and sort != '' ">
97   -order by ${sort}
98   -<if test="need != null">
99   -limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
100   -</if>
101   -</if>
102   -</sql>
  100 + <sql id="orderAndLimit">
  101 + <if test="sort != null and sort != '' ">
  102 + order by ${sort}
  103 + <if test="need != null">
  104 + limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
  105 + </if>
  106 + </if>
  107 + </sql>
103 108  
104 109  
  110 + <sql id="OrganizationCondition">
  111 + <where>
  112 + 1 = 1
  113 + <if test="id != null and id >= 0">
  114 + and id = #{id,jdbcType=INTEGER}
  115 + </if>
  116 + <if test="foreignId != null and foreignId != ''">
  117 + and foreign_id = #{foreignId,jdbcType=VARCHAR}
  118 + </if>
  119 + <if test="name != null and name != ''">
  120 + and name = #{name,jdbcType=VARCHAR}
  121 + </if>
  122 + <if test="type != null and type >= 0">
  123 + and type = #{type,jdbcType=INTEGER}
  124 + </if>
  125 + <if test="level != null and level >= 0">
  126 + and level = #{level,jdbcType=INTEGER}
  127 + </if>
  128 + <if test="areaManage != null and areaManage >= 0">
  129 + and area_manage = #{areaManage,jdbcType=INTEGER}
  130 + </if>
  131 + <if test="provinceId != null">
  132 + and province_id = #{provinceId,jdbcType=INTEGER}
  133 + </if>
  134 + <if test="cityId != null">
  135 + and city_id = #{cityId,jdbcType=INTEGER}
  136 + </if>
  137 + <if test="areaId != null">
  138 + and area_id = #{areaId,jdbcType=INTEGER}
  139 + </if>
  140 + <if test="address != null and address != ''">
  141 + and address = #{address,jdbcType=VARCHAR}
  142 + </if>
  143 + <if test="description != null and description != ''">
  144 + and description = #{description,jdbcType=VARCHAR}
  145 + </if>
  146 + <if test="publishId != null and publishId >= 0">
  147 + and publish_id = #{publishId,jdbcType=INTEGER}
  148 + </if>
  149 + <if test="publishName != null and publishName != ''">
  150 + and publish_name = #{publishName,jdbcType=VARCHAR}
  151 + </if>
  152 + <if test="yn != null and yn >= 0">
  153 + and yn = #{yn,jdbcType=INTEGER}
  154 + </if>
  155 + <if test="modified != null">
  156 + and modified = #{modified,jdbcType=TIMESTAMP}
  157 + </if>
  158 + <if test="created != null">
  159 + and created = #{created,jdbcType=TIMESTAMP}
  160 + </if>
  161 + <if test="shortCode != null and shortCode != ''">
  162 + and shortCode = #{shortCode,jdbcType=VARCHAR}
  163 + </if>
  164 + <if test="keyword != null and keyword != ''">
  165 + and name like CONCAT(#{keyword}, '%')
  166 + </if>
  167 + </where>
  168 + </sql>
105 169  
106   -<sql id="OrganizationCondition">
107   -<where>
108   - 1 = 1
109   -<if test="id != null and id >= 0">
110   -and id = #{id,jdbcType=INTEGER}
111   -</if>
112   -<if test="name != null and name != ''">
113   -and name = #{name,jdbcType=VARCHAR}
114   -</if>
115   -<if test="type != null and type >= 0">
116   -and type = #{type,jdbcType=INTEGER}
117   -</if>
118   -<if test="level != null and level >= 0">
119   -and level = #{level,jdbcType=INTEGER}
120   -</if>
121   -<if test="areaManage != null and areaManage >= 0">
122   -and area_manage = #{areaManage,jdbcType=INTEGER}
123   -</if>
124   -<if test="provinceId != null and provinceId >= 0">
125   -and province_id = #{provinceId,jdbcType=INTEGER}
126   -</if>
127   -<if test="cityId != null and cityId >= 0">
128   -and city_id = #{cityId,jdbcType=INTEGER}
129   -</if>
130   -<if test="areaId != null and areaId >= 0">
131   -and area_id = #{areaId,jdbcType=INTEGER}
132   -</if>
133   -<if test="address != null and address != ''">
134   -and address = #{address,jdbcType=VARCHAR}
135   -</if>
136   -<if test="description != null and description != ''">
137   -and description = #{description,jdbcType=VARCHAR}
138   -</if>
139   -<if test="publishId != null and publishId >= 0">
140   -and publish_id = #{publishId,jdbcType=INTEGER}
141   -</if>
142   -<if test="publishName != null and publishName != ''">
143   -and publish_name = #{publishName,jdbcType=VARCHAR}
144   -</if>
145   -<if test="yn != null and yn >= 0">
146   -and yn = #{yn,jdbcType=INTEGER}
147   -</if>
148   -<if test="modified != null">
149   -and modified = #{modified,jdbcType=TIMESTAMP}
150   -</if>
151   -<if test="created != null">
152   -and created = #{created,jdbcType=TIMESTAMP}
153   -</if>
154   -<if test="shortCode != null and shortCode != ''">
155   -and shortCode = #{shortCode,jdbcType=VARCHAR}
156   -</if>
157   - <if test="keyword != null and keyword != ''">
158   - and name like CONCAT(#{keyword}, '%')
159   - </if>
160   -</where>
161   -</sql>
162 170  
  171 + <select id="queryOrganization" resultMap="OrganizationResultMap"
  172 + parameterType="com.lyms.platform.permission.model.OrganizationQuery">
  173 + select
  174 + id,name,type,level,area_manage,province_id,city_id,area_id,address,description,publish_id,publish_name,yn,modified,created,shortCode,foreign_id
  175 + from organization
  176 + <include refid="OrganizationCondition"/>
  177 + <include refid="orderAndLimit"/>
  178 + </select>
163 179  
164 180  
165   -<select id="queryOrganization" resultMap="OrganizationResultMap" parameterType="com.lyms.platform.permission.model.OrganizationQuery">
166   -select id,name,type,level,area_manage,province_id,city_id,area_id,address,description,publish_id,publish_name,yn,modified,created,shortCode
167   - from organization
168   -<include refid="OrganizationCondition" />
169   -<include refid="orderAndLimit" />
170   -</select>
171   -
172   -
173   -
174   -<select id="queryOrganizationCount" resultType="int" parameterType="com.lyms.platform.permission.model.OrganizationQuery">
175   -select count(1) from organization
176   -<include refid="OrganizationCondition" />
177   -</select>
178   -
  181 + <select id="queryOrganizationCount" resultType="int"
  182 + parameterType="com.lyms.platform.permission.model.OrganizationQuery">
  183 + select count(1) from organization
  184 + <include refid="OrganizationCondition"/>
  185 + </select>
179 186  
180 187  
181 188 </mapper>
platform-biz-service/src/main/resources/mainOrm/Users.xml View file @ 1c47666
... ... @@ -2,257 +2,265 @@
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3 3 <mapper namespace="com.lyms.platform.permission.dao.UsersMapper">
4 4  
5   -<resultMap id="UsersResultMap" type="com.lyms.platform.permission.model.Users">
6   -<id column="id" property="id" jdbcType="INTEGER" />
7   -<result column="logincenter_id" property="logincenterId" jdbcType="INTEGER" />
8   -<result column="type" property="type" jdbcType="INTEGER" />
9   -<result column="org_id" property="orgId" jdbcType="INTEGER" />
10   -<result column="dept_id" property="deptId" jdbcType="INTEGER" />
11   - <result column="ks_id" property="ksId" jdbcType="INTEGER" />
12   -<result column="name" property="name" jdbcType="VARCHAR" />
13   -<result column="account" property="account" jdbcType="VARCHAR" />
14   -<result column="pwd" property="pwd" jdbcType="VARCHAR" />
15   -<result column="phone" property="phone" jdbcType="VARCHAR" />
16   -<result column="publish_id" property="publishId" jdbcType="INTEGER" />
17   -<result column="publish_name" property="publishName" jdbcType="VARCHAR" />
18   -<result column="yn" property="yn" jdbcType="INTEGER" />
19   -<result column="enable" property="enable" jdbcType="INTEGER" />
20   -<result column="modified" property="modified" jdbcType="TIMESTAMP" />
21   -<result column="created" property="created" jdbcType="TIMESTAMP" />
22   -<result column="remarks" property="remarks" jdbcType="VARCHAR" />
23   -<result column="last_login_time" property="lastLoginTime" jdbcType="TIMESTAMP" />
24   -</resultMap>
  5 + <resultMap id="UsersResultMap" type="com.lyms.platform.permission.model.Users">
  6 + <id column="id" property="id" jdbcType="INTEGER"/>
  7 + <result column="logincenter_id" property="logincenterId" jdbcType="INTEGER"/>
  8 + <result column="type" property="type" jdbcType="INTEGER"/>
  9 + <result column="org_id" property="orgId" jdbcType="INTEGER"/>
  10 + <result column="dept_id" property="deptId" jdbcType="INTEGER"/>
  11 + <result column="ks_id" property="ksId" jdbcType="INTEGER"/>
  12 + <result column="name" property="name" jdbcType="VARCHAR"/>
  13 + <result column="account" property="account" jdbcType="VARCHAR"/>
  14 + <result column="pwd" property="pwd" jdbcType="VARCHAR"/>
  15 + <result column="phone" property="phone" jdbcType="VARCHAR"/>
  16 + <result column="publish_id" property="publishId" jdbcType="INTEGER"/>
  17 + <result column="publish_name" property="publishName" jdbcType="VARCHAR"/>
  18 + <result column="yn" property="yn" jdbcType="INTEGER"/>
  19 + <result column="enable" property="enable" jdbcType="INTEGER"/>
  20 + <result column="modified" property="modified" jdbcType="TIMESTAMP"/>
  21 + <result column="created" property="created" jdbcType="TIMESTAMP"/>
  22 + <result column="remarks" property="remarks" jdbcType="VARCHAR"/>
  23 + <result column="last_login_time" property="lastLoginTime" jdbcType="TIMESTAMP"/>
  24 + <result column="foreign_id" property="foreignId" jdbcType="VARCHAR"/>
  25 + </resultMap>
25 26  
26 27  
27   -
28   -<insert id="addUsers" parameterType="com.lyms.platform.permission.model.Users">
29   -insert into users (logincenter_id,type,org_id,dept_id,name,account,pwd,phone,publish_id,publish_name,yn,enable,modified,created,remarks,last_login_time,ks_id) values (#{logincenterId},#{type},#{orgId},#{deptId},#{name},#{account},#{pwd},#{phone},#{publishId},#{publishName},#{yn},#{enable},#{modified},#{created},#{remarks},#{lastLoginTime},#{ksId})
  28 + <insert id="addUsers" parameterType="com.lyms.platform.permission.model.Users">
  29 + <selectKey order="AFTER" keyProperty="id" resultType="java.lang.Integer"> SELECT LAST_INSERT_ID() </selectKey>
  30 +insert into users (foreign_id,logincenter_id,type,org_id,dept_id,name,account,pwd,phone,publish_id,publish_name,yn,enable,modified,created,remarks,last_login_time,ks_id)
  31 +values (#{foreignId},#{logincenterId},#{type},#{orgId},#{deptId},#{name},#{account},#{pwd},#{phone},#{publishId},#{publishName},#{yn},#{enable},#{modified},#{created},#{remarks},#{lastLoginTime},#{ksId})
30 32 </insert>
31 33  
32 34  
  35 + <update id="updateUsers" parameterType="com.lyms.platform.permission.model.Users">
  36 + update users
  37 + <set>
  38 + <if test="logincenterId != null and logincenterId >= 0">
  39 + logincenter_id = #{logincenterId,jdbcType=INTEGER},
  40 + </if>
  41 + <if test="type != null and type >= 0">
  42 + type = #{type,jdbcType=INTEGER},
  43 + </if>
  44 + <if test="orgId != null and orgId >= 0">
  45 + org_id = #{orgId,jdbcType=INTEGER},
  46 + </if>
  47 + <if test="deptId != null and deptId >= 0">
  48 + dept_id = #{deptId,jdbcType=INTEGER},
  49 + </if>
  50 + <if test="ksId != null and ksId >= 0">
  51 + ks_id = #{ksId,jdbcType=INTEGER},
  52 + </if>
  53 + <if test="name != null and name != ''">
  54 + name = #{name,jdbcType=VARCHAR},
  55 + </if>
  56 + <if test="foreignId != null and foreignId != ''">
  57 + foreign_id = #{foreignId,jdbcType=VARCHAR},
  58 + </if>
  59 + <if test="account != null and account != ''">
  60 + account = #{account,jdbcType=VARCHAR},
  61 + </if>
  62 + <if test="pwd != null and pwd != ''">
  63 + pwd = #{pwd,jdbcType=VARCHAR},
  64 + </if>
  65 + <if test="phone != null and phone != ''">
  66 + phone = #{phone,jdbcType=VARCHAR},
  67 + </if>
  68 + <if test="publishId != null and publishId >= 0">
  69 + publish_id = #{publishId,jdbcType=INTEGER},
  70 + </if>
  71 + <if test="publishName != null and publishName != ''">
  72 + publish_name = #{publishName,jdbcType=VARCHAR},
  73 + </if>
  74 + <if test="yn != null and yn >= 0">
  75 + yn = #{yn,jdbcType=INTEGER},
  76 + </if>
  77 + <if test="enable != null and enable >= 0">
  78 + enable = #{enable,jdbcType=INTEGER},
  79 + </if>
  80 + <if test="modified != null">
  81 + modified = #{modified,jdbcType=TIMESTAMP},
  82 + </if>
  83 + <if test="created != null">
  84 + created = #{created,jdbcType=TIMESTAMP},
  85 + </if>
  86 + <if test="remarks != null and remarks != ''">
  87 + remarks = #{remarks,jdbcType=VARCHAR},
  88 + </if>
  89 + <if test="lastLoginTime != null">
  90 + last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
  91 + </if>
  92 + </set>
  93 + where id = #{id,jdbcType=INTEGER}
  94 + </update>
33 95  
34   -<update id="updateUsers" parameterType="com.lyms.platform.permission.model.Users">
35   -update users <set><if test="logincenterId != null and logincenterId >= 0">
36   -logincenter_id = #{logincenterId,jdbcType=INTEGER},
37   -</if>
38   -<if test="type != null and type >= 0">
39   -type = #{type,jdbcType=INTEGER},
40   -</if>
41   -<if test="orgId != null and orgId >= 0">
42   -org_id = #{orgId,jdbcType=INTEGER},
43   -</if>
44   -<if test="deptId != null and deptId >= 0">
45   -dept_id = #{deptId,jdbcType=INTEGER},
46   -</if>
47   - <if test="ksId != null and ksId >= 0">
48   - ks_id = #{ksId,jdbcType=INTEGER},
49   - </if>
50   -<if test="name != null and name != ''">
51   -name = #{name,jdbcType=VARCHAR},
52   -</if>
53   -<if test="account != null and account != ''">
54   -account = #{account,jdbcType=VARCHAR},
55   -</if>
56   -<if test="pwd != null and pwd != ''">
57   -pwd = #{pwd,jdbcType=VARCHAR},
58   -</if>
59   -<if test="phone != null and phone != ''">
60   -phone = #{phone,jdbcType=VARCHAR},
61   -</if>
62   -<if test="publishId != null and publishId >= 0">
63   -publish_id = #{publishId,jdbcType=INTEGER},
64   -</if>
65   -<if test="publishName != null and publishName != ''">
66   -publish_name = #{publishName,jdbcType=VARCHAR},
67   -</if>
68   -<if test="yn != null and yn >= 0">
69   -yn = #{yn,jdbcType=INTEGER},
70   -</if>
71   -<if test="enable != null and enable >= 0">
72   -enable = #{enable,jdbcType=INTEGER},
73   -</if>
74   -<if test="modified != null">
75   -modified = #{modified,jdbcType=TIMESTAMP},
76   -</if>
77   -<if test="created != null">
78   -created = #{created,jdbcType=TIMESTAMP},
79   -</if>
80   -<if test="remarks != null and remarks != ''">
81   -remarks = #{remarks,jdbcType=VARCHAR},
82   -</if>
83   -<if test="lastLoginTime != null">
84   -last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
85   -</if>
86   -</set>
87   -where id = #{id,jdbcType=INTEGER}
88   -</update>
89 96  
90   -
91   -<delete id="deleteUsers" parameterType="java.lang.Integer">
  97 + <delete id="deleteUsers" parameterType="java.lang.Integer">
92 98 delete from users where id = #{id,jdbcType=INTEGER}
93 99 </delete>
94 100  
95 101  
96   -
97   -<select id="getUsers" resultMap="UsersResultMap" parameterType="java.lang.Integer">
98   -select id,logincenter_id,type,org_id,dept_id,name,account,pwd,phone,publish_id,publish_name,yn,enable,modified,created,remarks,last_login_time, ks_id
  102 + <select id="getUsers" resultMap="UsersResultMap" parameterType="java.lang.Integer">
  103 +select id,logincenter_id,type,org_id,dept_id,name,account,pwd,phone,publish_id,publish_name,yn,enable,modified,created,remarks,last_login_time, ks_id,foreign_id
99 104 from users where id = #{id,jdbcType=INTEGER}
100 105 </select>
101 106  
102   - <select id="getUsersByLoginCenterId" resultMap="UsersResultMap" parameterType="java.lang.Integer">
103   - select id,logincenter_id,type,org_id,dept_id,name,account,pwd,phone,publish_id,publish_name,yn,enable,modified,created,remarks,last_login_time, ks_id
  107 + <select id="getUsersByLoginCenterId" resultMap="UsersResultMap" parameterType="java.lang.Integer">
  108 + select id,logincenter_id,type,org_id,dept_id,name,account,pwd,phone,publish_id,publish_name,yn,enable,modified,created,remarks,last_login_time, ks_id,foreign_id
104 109 from users where logincenter_id = #{id,jdbcType=INTEGER}
105 110 </select>
106 111  
107 112  
108   -<sql id="orderAndLimit">
109   -<if test="sort != null and sort != '' ">
110   -order by ${sort}
111   -<if test="need != null">
112   -limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
113   -</if>
114   -</if>
115   -</sql>
  113 + <sql id="orderAndLimit">
  114 + <if test="sort != null and sort != '' ">
  115 + order by ${sort}
  116 + <if test="need != null">
  117 + limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
  118 + </if>
  119 + </if>
  120 + </sql>
116 121  
117 122  
  123 + <sql id="UsersCondition">
  124 + <where>
  125 + 1 = 1
  126 + <if test="id != null and id >= 0">
  127 + and id = #{id,jdbcType=INTEGER}
  128 + </if>
  129 + <if test="logincenterId != null and logincenterId >= 0">
  130 + and logincenter_id = #{logincenterId,jdbcType=INTEGER}
  131 + </if>
  132 + <if test="type != null and type >= 0">
  133 + and type = #{type,jdbcType=INTEGER}
  134 + </if>
  135 + <if test="orgId != null and orgId >= 0">
  136 + and org_id = #{orgId,jdbcType=INTEGER}
  137 + </if>
  138 + <if test="deptId != null and deptId >= 0">
  139 + and dept_id = #{deptId,jdbcType=INTEGER}
  140 + </if>
  141 + <if test="ksId != null and ksId >= 0">
  142 + and ks_id = #{ksId,jdbcType=INTEGER}
  143 + </if>
  144 + <if test="name != null and name != ''">
  145 + and name = #{name,jdbcType=VARCHAR}
  146 + </if>
  147 + <if test="foreignId != null and foreignId != ''">
  148 + and foreign_id = #{foreignId,jdbcType=VARCHAR}
  149 + </if>
  150 + <if test="account != null and account != ''">
  151 + and account = #{account,jdbcType=VARCHAR}
  152 + </if>
  153 + <if test="pwd != null and pwd != ''">
  154 + and pwd = #{pwd,jdbcType=VARCHAR}
  155 + </if>
  156 + <if test="phone != null and phone != ''">
  157 + and phone = #{phone,jdbcType=VARCHAR}
  158 + </if>
  159 + <if test="publishId != null and publishId >= 0">
  160 + and publish_id = #{publishId,jdbcType=INTEGER}
  161 + </if>
  162 + <if test="publishName != null and publishName != ''">
  163 + and publish_name = #{publishName,jdbcType=VARCHAR}
  164 + </if>
  165 + <if test="yn != null and yn >= 0">
  166 + and yn = #{yn,jdbcType=INTEGER}
  167 + </if>
  168 + <if test="enable != null and enable >= 0">
  169 + and enable = #{enable,jdbcType=INTEGER}
  170 + </if>
  171 + <if test="modified != null">
  172 + and modified = #{modified,jdbcType=TIMESTAMP}
  173 + </if>
  174 + <if test="created != null">
  175 + and created = #{created,jdbcType=TIMESTAMP}
  176 + </if>
  177 + <if test="remarks != null and remarks != ''">
  178 + and remarks = #{remarks,jdbcType=VARCHAR}
  179 + </if>
  180 + <if test="lastLoginTime != null">
  181 + and last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP}
  182 + </if>
  183 + </where>
  184 + </sql>
118 185  
119   -<sql id="UsersCondition">
120   -<where>
121   - 1 = 1
122   -<if test="id != null and id >= 0">
123   -and id = #{id,jdbcType=INTEGER}
124   -</if>
125   -<if test="logincenterId != null and logincenterId >= 0">
126   -and logincenter_id = #{logincenterId,jdbcType=INTEGER}
127   -</if>
128   -<if test="type != null and type >= 0">
129   -and type = #{type,jdbcType=INTEGER}
130   -</if>
131   -<if test="orgId != null and orgId >= 0">
132   -and org_id = #{orgId,jdbcType=INTEGER}
133   -</if>
134   -<if test="deptId != null and deptId >= 0">
135   - and dept_id = #{deptId,jdbcType=INTEGER}
136   -</if>
137   - <if test="ksId != null and ksId >= 0">
138   - and ks_id = #{ksId,jdbcType=INTEGER}
139   - </if>
140   -<if test="name != null and name != ''">
141   -and name = #{name,jdbcType=VARCHAR}
142   -</if>
143   -<if test="account != null and account != ''">
144   -and account = #{account,jdbcType=VARCHAR}
145   -</if>
146   -<if test="pwd != null and pwd != ''">
147   -and pwd = #{pwd,jdbcType=VARCHAR}
148   -</if>
149   -<if test="phone != null and phone != ''">
150   -and phone = #{phone,jdbcType=VARCHAR}
151   -</if>
152   -<if test="publishId != null and publishId >= 0">
153   -and publish_id = #{publishId,jdbcType=INTEGER}
154   -</if>
155   -<if test="publishName != null and publishName != ''">
156   -and publish_name = #{publishName,jdbcType=VARCHAR}
157   -</if>
158   -<if test="yn != null and yn >= 0">
159   -and yn = #{yn,jdbcType=INTEGER}
160   -</if>
161   -<if test="enable != null and enable >= 0">
162   -and enable = #{enable,jdbcType=INTEGER}
163   -</if>
164   -<if test="modified != null">
165   -and modified = #{modified,jdbcType=TIMESTAMP}
166   -</if>
167   -<if test="created != null">
168   -and created = #{created,jdbcType=TIMESTAMP}
169   -</if>
170   -<if test="remarks != null and remarks != ''">
171   -and remarks = #{remarks,jdbcType=VARCHAR}
172   -</if>
173   -<if test="lastLoginTime != null">
174   -and last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP}
175   -</if>
176   -</where>
177   -</sql>
178 186  
  187 + <select id="queryUsers" resultMap="UsersResultMap" parameterType="com.lyms.platform.permission.model.UsersQuery">
  188 + select
  189 + id,logincenter_id,type,org_id,dept_id,name,account,pwd,phone,publish_id,publish_name,yn,enable,modified,created,remarks,last_login_time,
  190 + ks_id,foreign_id
  191 + from users
  192 + <include refid="UsersCondition"/>
  193 + <include refid="orderAndLimit"/>
  194 + </select>
179 195  
180 196  
181   -<select id="queryUsers" resultMap="UsersResultMap" parameterType="com.lyms.platform.permission.model.UsersQuery">
182   -select id,logincenter_id,type,org_id,dept_id,name,account,pwd,phone,publish_id,publish_name,yn,enable,modified,created,remarks,last_login_time, ks_id
183   - from users
184   -<include refid="UsersCondition" />
185   -<include refid="orderAndLimit" />
186   -</select>
  197 + <select id="queryUsers2" resultMap="UsersResultMap" parameterType="com.lyms.platform.permission.model.UsersQuery">
  198 + select DISTINCT u.id
  199 + id,logincenter_id,type,org_id,dept_id,name,account,pwd,phone,publish_id,publish_name,u.yn,enable,modified,created,remarks,last_login_time,
  200 + ks_id,foreign_id
  201 + from users u LEFT JOIN user_role_maps ur
  202 + on u.id = ur.user_id
  203 + where 1=1
  204 + <if test="keyword != null and keyword != ''">
  205 + and name like CONCAT(#{keyword}, '%')
  206 + </if>
  207 + <if test="ksId != null and ksId != ''">
  208 + and u.ks_id = #{ksId,jdbcType=INTEGER}
  209 + </if>
  210 + <if test="orgId != null and orgId != ''">
  211 + and u.org_id = #{orgId,jdbcType=INTEGER}
  212 + </if>
  213 + <if test="deptId != null and deptId != ''">
  214 + and u.dept_id = #{deptId,jdbcType=INTEGER}
  215 + </if>
  216 + <if test="roleId != null and roleId != ''">
  217 + and ur.role_id = #{roleId,jdbcType=INTEGER}
  218 + </if>
  219 + <if test="yn != null and yn != ''">
  220 + and u.yn = #{yn,jdbcType=INTEGER}
  221 + and ur.yn = #{yn,jdbcType=INTEGER}
  222 + </if>
  223 + <if test="type != null and type != ''">
  224 + and u.type = #{type,jdbcType=INTEGER}
  225 + </if>
  226 + <include refid="orderAndLimit"/>
  227 + </select>
187 228  
188 229  
189   - <select id="queryUsers2" resultMap="UsersResultMap" parameterType="com.lyms.platform.permission.model.UsersQuery">
190   - select DISTINCT u.id id,logincenter_id,type,org_id,dept_id,name,account,pwd,phone,publish_id,publish_name,u.yn,enable,modified,created,remarks,last_login_time, ks_id
191   - from users u LEFT JOIN user_role_maps ur
192   - on u.id = ur.user_id
193   - where 1=1
194   - <if test="keyword != null and keyword != ''">
195   - and name like CONCAT(#{keyword}, '%')
196   - </if>
197   - <if test="ksId != null and ksId != ''">
198   - and u.ks_id = #{ksId,jdbcType=INTEGER}
199   - </if>
200   - <if test="orgId != null and orgId != ''">
201   - and u.org_id = #{orgId,jdbcType=INTEGER}
202   - </if>
203   - <if test="deptId != null and deptId != ''">
204   - and u.dept_id = #{deptId,jdbcType=INTEGER}
205   - </if>
206   - <if test="roleId != null and roleId != ''">
207   - and ur.role_id = #{roleId,jdbcType=INTEGER}
208   - </if>
209   - <if test="yn != null and yn != ''">
210   - and u.yn = #{yn,jdbcType=INTEGER}
211   - and ur.yn = #{yn,jdbcType=INTEGER}
212   - </if>
213   - <if test="type != null and type != ''">
214   - and u.type = #{type,jdbcType=INTEGER}
215   - </if>
216   - <include refid="orderAndLimit" />
217   - </select>
  230 + <select id="queryUsersCount2" resultType="int" parameterType="com.lyms.platform.permission.model.UsersQuery">
  231 + select count(DISTINCT u.id)
  232 + from users u LEFT JOIN user_role_maps ur
  233 + on u.id = ur.user_id
  234 + where 1=1
  235 + <if test="keyword != null and keyword != ''">
  236 + and name like CONCAT(#{keyword}, '%')
  237 + </if>
  238 + <if test="ksId != null and ksId != ''">
  239 + and u.ks_id = #{ksId,jdbcType=INTEGER}
  240 + </if>
  241 + <if test="orgId != null and orgId != ''">
  242 + and u.org_id = #{orgId,jdbcType=INTEGER}
  243 + </if>
  244 + <if test="deptId != null and deptId != ''">
  245 + and u.dept_id = #{deptId,jdbcType=INTEGER}
  246 + </if>
  247 + <if test="roleId != null and roleId != ''">
  248 + and ur.role_id = #{roleId,jdbcType=INTEGER}
  249 + </if>
  250 + <if test="yn != null and yn != ''">
  251 + and u.yn = #{yn,jdbcType=INTEGER}
  252 + and ur.yn = #{yn,jdbcType=INTEGER}
  253 + </if>
  254 + <if test="type != null and type != ''">
  255 + and u.type = #{type,jdbcType=INTEGER}
  256 + </if>
  257 + </select>
218 258  
219 259  
220   -
221   - <select id="queryUsersCount2" resultType="int" parameterType="com.lyms.platform.permission.model.UsersQuery">
222   - select count(DISTINCT u.id)
223   - from users u LEFT JOIN user_role_maps ur
224   - on u.id = ur.user_id
225   - where 1=1
226   - <if test="keyword != null and keyword != ''">
227   - and name like CONCAT(#{keyword}, '%')
228   - </if>
229   - <if test="ksId != null and ksId != ''">
230   - and u.ks_id = #{ksId,jdbcType=INTEGER}
231   - </if>
232   - <if test="orgId != null and orgId != ''">
233   - and u.org_id = #{orgId,jdbcType=INTEGER}
234   - </if>
235   - <if test="deptId != null and deptId != ''">
236   - and u.dept_id = #{deptId,jdbcType=INTEGER}
237   - </if>
238   - <if test="roleId != null and roleId != ''">
239   - and ur.role_id = #{roleId,jdbcType=INTEGER}
240   - </if>
241   - <if test="yn != null and yn != ''">
242   - and u.yn = #{yn,jdbcType=INTEGER}
243   - and ur.yn = #{yn,jdbcType=INTEGER}
244   - </if>
245   - <if test="type != null and type != ''">
246   - and u.type = #{type,jdbcType=INTEGER}
247   - </if>
248   - </select>
249   -
250   -
251   -<select id="queryUsersCount" resultType="int" parameterType="com.lyms.platform.permission.model.UsersQuery">
252   -select count(1) from users
253   -<include refid="UsersCondition" />
254   -</select>
255   -
  260 + <select id="queryUsersCount" resultType="int" parameterType="com.lyms.platform.permission.model.UsersQuery">
  261 + select count(1) from users
  262 + <include refid="UsersCondition"/>
  263 + </select>
256 264  
257 265  
258 266 </mapper>
platform-data-api/src/main/java/com/lyms/platform/data/controller/TaskController.java View file @ 1c47666
... ... @@ -42,7 +42,12 @@
42 42 if ("basicConfig".equals(sid)) {
43 43 dataImportTaskService.updateBasicConfig();
44 44 writeString(response, "success");
45   - } else {
  45 + } else if ("fullUpdateUsers".equals(sid)) {
  46 + dataImportTaskService.fullUpdateUsers();
  47 + writeString(response, "success");
  48 + }
  49 +
  50 + else {
46 51 writeString(response, "nomethod");
47 52 }
48 53  
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/DataImportTaskServiceImpl.java View file @ 1c47666
... ... @@ -4,9 +4,10 @@
4 4 import com.lyms.platform.common.enums.YnEnums;
5 5 import com.lyms.platform.common.utils.LogUtil;
6 6 import com.lyms.platform.data.service.DataImportTaskService;
7   -import com.lyms.platform.permission.model.Organization;
8   -import com.lyms.platform.permission.model.OrganizationQuery;
  7 +import com.lyms.platform.permission.model.*;
  8 +import com.lyms.platform.permission.service.DepartmentsService;
9 9 import com.lyms.platform.permission.service.OrganizationService;
  10 +import com.lyms.platform.permission.service.UsersService;
10 11 import com.lyms.platform.pojo.BasicConfig;
11 12 import com.lymsh.mommybaby.earlydata.dao.PlatMapper;
12 13 import com.lymsh.mommybaby.earlydata.model.PlatDataContent;
13 14  
... ... @@ -15,7 +16,9 @@
15 16 import org.springframework.beans.factory.annotation.Autowired;
16 17 import org.springframework.stereotype.Service;
17 18  
  19 +import java.math.BigDecimal;
18 20 import java.util.Date;
  21 +import java.util.HashMap;
19 22 import java.util.List;
20 23 import java.util.Map;
21 24  
22 25  
... ... @@ -29,11 +32,28 @@
29 32 private OrganizationService organizationService;
30 33  
31 34 @Autowired
  35 + private DepartmentsService departmentsService;
  36 +
  37 + @Autowired
  38 + private UsersService usersService;
  39 +
  40 + @Autowired
32 41 private BasicConfigService basicConfigService;
33 42  
34 43 @Autowired
35 44 private PlatMapper platMapper;
36 45  
  46 + public Integer getInteger(Object obj) {
  47 + if (obj == null) {
  48 + return null;
  49 + }
  50 + try {
  51 + return ((BigDecimal) obj).intValue();
  52 + } catch (Exception e) {
  53 + return null;
  54 + }
  55 + }
  56 +
37 57 @Override
38 58 public void updateUsers() {
39 59 Date startTime = new DateTime().minusMinutes(7).toDate();
40 60  
41 61  
42 62  
43 63  
44 64  
45 65  
46 66  
... ... @@ -57,18 +77,127 @@
57 77 try {
58 78 List<Map> list = platMapper.selectAllUserByHospitalId(hospitalForeignId, startTime);
59 79 if (list != null && list.size() > 0) {
  80 + Map<String, Organization> organizationMap = new HashMap<>();
60 81 Organization organization = new Organization();
  82 + Departments departments = new Departments();
  83 + Users users = new Users();
61 84 for (Map map:list) {
62 85 try {
63 86 // organization
64   - if (StringUtils.isBlank(organization.getForeignId()) || organization.getForeignId().equals(map.get("H_ID"))) {
  87 + if (StringUtils.isBlank(organization.getForeignId()) || !organization.getForeignId().equals(map.get("H_ID"))) {
65 88 organization.setForeignId(map.get("H_ID").toString());
66 89 organization.setYn(YnEnums.YES.getId());
  90 + organization.setName(map.get("H_NAME").toString());
  91 + organization.setAreaId(map.get("H_COUNTYNO") == null ? null : map.get("H_COUNTYNO").toString());
  92 + organization.setCityId(map.get("H_CITYNO") == null ? null : map.get("H_CITYNO").toString());
  93 + organization.setLevel(getInteger(map.get("H_LEVEL")));
  94 + organization.setProvinceId(map.get("H_PROVINCENO") == null ? null : map.get("H_PROVINCENO").toString());
  95 + organization.setShortCode(map.get("H_HELPCODE") == null ? null : map.get("H_HELPCODE").toString());
  96 + organization.setType(getInteger(map.get("H_TYPE")));
  97 + organization.setAreaManage(getInteger(map.get("H_ISLEADER")));
  98 + organization.setPublishId(0);
  99 + organization.setPublishName("system");
  100 + organization.setModified(new Date());
  101 + if (!organizationMap.containsKey(organization.getForeignId())) {
  102 + organizationMap.put(organization.getForeignId(),organization);
  103 + }
67 104 }
68 105  
  106 + // Departments
  107 + if (StringUtils.isBlank(departments.getForeignId()) || !departments.getForeignId().equals(map.get("D_ID"))) {
  108 + departments.setPublishName("system");
  109 + departments.setType(2);
  110 + departments.setPublishId(0);
  111 + departments.setShortCode(map.get("D_HELPCODE") == null ? null : map.get("D_HELPCODE").toString());
  112 + departments.setYn(YnEnums.YES.getId());
  113 + departments.setForeignId(map.get("D_ID").toString());
  114 + departments.setModified(new Date());
  115 + departments.setName(map.get("D_NAME") == null ? null : map.get("D_NAME").toString());
  116 + if (!organization.getDepartmentsMap().containsKey(departments.getForeignId())) {
  117 + organization.getDepartmentsMap().put(departments.getForeignId(), departments);
  118 + }
  119 + }
69 120  
  121 + // users
  122 + if (StringUtils.isBlank(users.getForeignId()) || !users.getForeignId().equals(map.get("U_ID"))) {
  123 + users.setPublishId(0);
  124 + users.setPublishName("system");
  125 + users.setOrgId(organization.getId());
  126 + users.setName(map.get("E_NAME") == null ? null : map.get("E_NAME").toString());
  127 + users.setAccount(map.get("U_USERNAME") == null ? null : map.get("U_USERNAME").toString());
  128 + users.setForeignId(map.get("U_ID").toString());
  129 + users.setYn(YnEnums.YES.getId());
  130 + users.setModified(new Date());
  131 + users.setDeptId(departments.getId());
  132 + Integer enable = getInteger(map.get("U_ISVALID"));
  133 + if (enable != null && enable == 1) {
  134 + users.setEnable(1);
  135 + } else {
  136 + users.setEnable(2);
  137 + }
  138 + users.setKsId(departments.getId());
  139 + if (!departments.getUsersMap().containsKey(users.getForeignId())) {
  140 + departments.getUsersMap().put(users.getForeignId(), users);
  141 + }
  142 +
  143 + //TODO 手机号,权限 对应中间表
  144 +// users.setPhone("");
  145 +// String roles = map.get("UR_ROLEIDS")==null?null:map.get("UR_ROLEIDS").toString();
  146 + }
  147 +
  148 +
70 149 } catch (Exception ee) {
  150 + LogUtil.taskError(ee.getMessage(), ee);
  151 + }
  152 + }
71 153  
  154 + // save
  155 + OrganizationQuery organizationQuery = new OrganizationQuery();
  156 + DepartmentsQuery departmentsQuery = new DepartmentsQuery();
  157 + UsersQuery usersQuery = new UsersQuery();
  158 + for (Organization o:organizationMap.values()) {
  159 + try {
  160 + organizationQuery.setForeignId(organization.getForeignId());
  161 + List<Organization> organizationList = organizationService.queryOrganization(organizationQuery);
  162 + if (organizationList != null && organizationList.size() > 0) {
  163 + for (Organization odb:organizationList) {
  164 + organization.setId(odb.getId());
  165 + organizationService.updateOrganization(organization);
  166 + }
  167 + } else {
  168 + organization.setCreated(organization.getModified());
  169 + organizationService.addOrganization(organization);
  170 + }
  171 + for (Departments d:organization.getDepartmentsMap().values()) {
  172 + departments.setOrgId(organization.getId());
  173 + departmentsQuery.setForeignId(departments.getForeignId());
  174 + List<Departments> departmentsList = departmentsService.queryDepartments(departmentsQuery);
  175 + if (departmentsList != null && departmentsList.size() > 0) {
  176 + for (Departments dd:departmentsList) {
  177 + departments.setId(dd.getId());
  178 + departmentsService.updateDepartments(departments);
  179 + }
  180 + } else {
  181 + departments.setCreated(departments.getModified());
  182 + departmentsService.addDepartments(departments);
  183 + }
  184 + for (Users u:departments.getUsersMap().values()) {
  185 + usersQuery.setForeignId(users.getForeignId());
  186 + List<Users> usersList = usersService.queryUsers(usersQuery);
  187 + if (usersList != null && usersList.size() > 0) {
  188 + for (Users du:usersList) {
  189 + users.setId(du.getId());
  190 + usersService.updateUsers(users);
  191 + }
  192 + } else {
  193 + users.setCreated(users.getModified());
  194 + usersService.addUsers(users);
  195 + }
  196 + }
  197 + }
  198 +
  199 + } catch (Exception ee) {
  200 + LogUtil.taskError(ee.getMessage(), ee);
72 201 }
73 202 }
74 203 } else {
platform-data-api/src/main/webapp/WEB-INF/vm/task/index.vm View file @ 1c47666
... ... @@ -25,11 +25,19 @@
25 25 <button class="btn btn-sm btn-danger" onclick="execOne('basicConfig')">执行</button>
26 26 </td>
27 27 </tr>
  28 + <tr>
  29 + <td>机构、部门、用户(医生)</td>
  30 + <td></td>
  31 + <td>无</td>
  32 + <td>
  33 + <button class="btn btn-sm btn-danger" onclick="execOne('fullUpdateUsers')">执行</button>
  34 + </td>
  35 + </tr>
28 36 </table>
29 37  
30 38 <script>
31 39 layer.config({extend: 'extend/layer.ext.js'});
32   - function execOne(sid,fid,pass) {
  40 + function execOne(sid,fid) {
33 41 layer.prompt({
34 42 title: '输入PASS',
35 43 formType: 0
platform-mommyData/src/main/resources/earlyOrm/Plat.xml View file @ 1c47666
... ... @@ -198,7 +198,7 @@
198 198  
199 199 <select id="selectAllUserByHospitalId" resultType="hashmap" parameterType="map">
200 200 select
201   - h.h_id,h.h_name,h.h_helpcode,h.h_introduce,h.h_servicesuffix,h.h_isvalid,h.h_operuser,h.h_des,h.h_provinceno,h.h_cityno,h.h_countyno,
  201 + h.h_id,h.h_name,h.h_helpcode,h.h_introduce,h.h_servicesuffix,h.h_isvalid,h.h_operuser,h.h_des,h.h_provinceno,h.h_cityno,h.h_countyno,h.h_township,h.h_street,h.h_type,h.h_level,h.h_isleader,
202 202 d.*,
203 203 e.E_ID,e.E_NAME,e.E_SEX,e.E_HOSPITALID,e.E_JOBTITLEID,e.E_DEPTID ,
204 204 u.*,
... ... @@ -211,7 +211,7 @@
211 211 left join plat_userrole ur on ur.ur_userid = u.u_id and ur.ur_roleid is not null and ur.ur_isvalid =1
212 212 left join plat_role r on r.r_id = ur.ur_roleid
213 213  
214   - where u.u_id is not null
  214 + where u.u_id is not null and h.h_name is not null
215 215 <if test="hospitalId != null">
216 216 and h.h_id = #{hospitalId}
217 217 </if>
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CommunityConfigController.java View file @ 1c47666
... ... @@ -70,10 +70,7 @@
70 70 } else {
71 71 communityConfig.setGxxq( names.substring(1, names.length()));
72 72 }
73   -
74   -
75 73 communityConfigService.updateCommunity(communityConfig);
76   -
77 74 return new BaseResponse()
78 75 .setErrorcode(ErrorCodeConstants.SUCCESS)
79 76 .setErrormsg("添加成功!");