浏览代码

修改标准映射查询方法

guxinyu 2 年之前
父节点
当前提交
1155f0b647

二进制
cbkj_web_parameter/src/main/java/com/jiuzhekan/cbkj/beans/dic/TDicBase.java


二进制
cbkj_web_parameter/src/main/java/com/jiuzhekan/cbkj/beans/dic/TDicStandard.java


二进制
cbkj_web_parameter/src/main/java/com/jiuzhekan/cbkj/controller/dic/TDicMappingController.java


二进制
cbkj_web_parameter/src/main/java/com/jiuzhekan/cbkj/controller/dic/TDicStandardController.java


二进制
cbkj_web_parameter/src/main/java/com/jiuzhekan/cbkj/mapper/dic/TDicStandardMapper.java


二进制
cbkj_web_parameter/src/main/java/com/jiuzhekan/cbkj/service/common/ImportInsService.java


二进制
cbkj_web_parameter/src/main/java/com/jiuzhekan/cbkj/service/dic/TDicStandardService.java


+ 1 - 1
cbkj_web_parameter/src/main/resources/mappers/dic/TDicBaseMapper.xml

@@ -20,7 +20,7 @@
         <result column="create_user_name" jdbcType="VARCHAR" property="createUserName"/>
         <result column="status" jdbcType="VARCHAR" property="status"/>
         <result column="mapping" jdbcType="VARCHAR" property="mapping"/>
-        <result column="id" jdbcType="VARCHAR" property="id"/>
+        <result column="id" jdbcType="VARCHAR" property="mapId"/>
     </resultMap>
 
 

+ 91 - 53
cbkj_web_parameter/src/main/resources/mappers/dic/TDicStandardMapper.xml

@@ -3,43 +3,47 @@
 <mapper namespace="com.jiuzhekan.cbkj.mapper.dic.TDicStandardMapper">
 
     <resultMap id="BaseResultMap" type="com.jiuzhekan.cbkj.beans.dic.TDicStandard">
-        <id column="stan_id" jdbcType="VARCHAR"  property="stanId" />
-        <result column="stan_code" jdbcType="VARCHAR" property="stanCode" />
-        <result column="stan_name" jdbcType="VARCHAR" property="stanName" />
-        <result column="parent_id" jdbcType="VARCHAR" property="parentId" />
-        <result column="stan_desc" jdbcType="VARCHAR" property="stanDesc" />
-        <result column="stan_type" jdbcType="VARCHAR" property="stanType" />
-        <result column="sort" jdbcType="VARCHAR" property="sort" />
-        <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
-        <result column="create_user" jdbcType="VARCHAR" property="createUser" />
-        <result column="create_user_name" jdbcType="VARCHAR" property="createUserName" />
-        <result column="status" jdbcType="VARCHAR" property="status" />
+        <id column="stan_id" jdbcType="VARCHAR" property="stanId"/>
+        <result column="stan_code" jdbcType="VARCHAR" property="stanCode"/>
+        <result column="stan_name" jdbcType="VARCHAR" property="stanName"/>
+        <result column="parent_id" jdbcType="VARCHAR" property="parentId"/>
+        <result column="stan_desc" jdbcType="VARCHAR" property="stanDesc"/>
+        <result column="stan_type" jdbcType="VARCHAR" property="stanType"/>
+        <result column="sort" jdbcType="VARCHAR" property="sort"/>
+        <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
+        <result column="create_user" jdbcType="VARCHAR" property="createUser"/>
+        <result column="create_user_name" jdbcType="VARCHAR" property="createUserName"/>
+        <result column="status" jdbcType="VARCHAR" property="status"/>
+        <result column="dic_id" jdbcType="VARCHAR" property="dicId"/>
     </resultMap>
 
 
     <sql id="Base_Column_List">
-    stan_id,stan_code,stan_name,parent_id,stan_desc,stan_type,sort,create_date,create_user,create_user_name,status
+        stan_id
+        ,stan_code,stan_name,parent_id,stan_desc,stan_type,sort,create_date,create_user,create_user_name,status
     </sql>
 
     <delete id="deleteByPrimaryKey" parameterType="TDicStandard">
-        delete from t_dic_standard where stan_id = #{ stanId }
+        delete
+        from t_dic_standard
+        where stan_id = #{ stanId }
     </delete>
 
     <delete id="deleteBylist" parameterType="ArrayList">
         delete from t_dic_standard where stan_id in
         <foreach collection="array" item="item" open="(" separator="," close=")">
-        #{item}
+            #{item}
         </foreach>
     </delete>
 
-    <insert id="insert"  parameterType="TDicStandard">
-        insert into t_dic_standard (<include refid="Base_Column_List" />) values
+    <insert id="insert" parameterType="TDicStandard">
+        insert into t_dic_standard (<include refid="Base_Column_List"/>) values
         (#{stanId},#{stanCode},#{stanName},#{parentId},#{stanDesc},#{stanType},#{sort},#{createDate},#{createUser},#{createUserName},#{status})
     </insert>
 
     <insert id="insertList" parameterType="List">
-        insert into t_dic_standard (<include refid="Base_Column_List" />) values
-        <foreach collection="list" item="item" index="index" separator="," >
+        insert into t_dic_standard (<include refid="Base_Column_List"/>) values
+        <foreach collection="list" item="item" index="index" separator=",">
             (#{item.stanId},#{item.stanCode},#{item.stanName},#{item.parentId},#{item.stanDesc},#{item.stanType},#{item.sort},#{item.createDate},#{item.createUser},#{item.createUserName},#{item.status})
         </foreach>
     </insert>
@@ -47,61 +51,95 @@
     <update id="updateByPrimaryKey" parameterType="TDicStandard">
         update t_dic_standard
         <set>
-             <if test="stanCode != null and stanCode!=''">
+            <if test="stanCode != null and stanCode!=''">
                 stan_code = #{ stanCode },
-             </if>
-             <if test="stanName != null and stanName!=''">
+            </if>
+            <if test="stanName != null and stanName!=''">
                 stan_name = #{ stanName },
-             </if>
-             <if test="parentId != null and parentId!=''">
+            </if>
+            <if test="parentId != null and parentId!=''">
                 parent_id = #{ parentId },
-             </if>
-             <if test="stanDesc != null and stanDesc!=''">
+            </if>
+            <if test="stanDesc != null and stanDesc!=''">
                 stan_desc = #{ stanDesc },
-             </if>
-             <if test="stanType != null and stanType!=''">
+            </if>
+            <if test="stanType != null and stanType!=''">
                 stan_type = #{ stanType },
-             </if>
-             <if test="sort != null and sort!=''">
+            </if>
+            <if test="sort != null and sort!=''">
                 sort = #{ sort },
-             </if>
-             <if test="createDate != null and createDate!=''">
+            </if>
+            <if test="createDate != null and createDate!=''">
                 create_date = #{ createDate },
-             </if>
-             <if test="createUser != null and createUser!=''">
+            </if>
+            <if test="createUser != null and createUser!=''">
                 create_user = #{ createUser },
-             </if>
-             <if test="createUserName != null and createUserName!=''">
+            </if>
+            <if test="createUserName != null and createUserName!=''">
                 create_user_name = #{ createUserName },
-             </if>
-             <if test="status != null and status!=''">
+            </if>
+            <if test="status != null and status!=''">
                 status = #{status},
-             </if>
+            </if>
         </set>
         where stan_id = #{ stanId }
     </update>
 
     <select id="getObjectById" resultMap="BaseResultMap" parameterType="String">
-        select <include refid="Base_Column_List" />
+        select
+        <include refid="Base_Column_List"/>
         from t_dic_standard where stan_id = #{ stanId }
     </select>
 
     <select id="getPageListByObj" parameterType="TDicStandard" resultMap="BaseResultMap">
-        SELECT tds.stan_id,tds.stan_code,tds.stan_name,tds.parent_id,tds.stan_desc,tds.stan_type,tds.sort,tds.create_date,tds.create_user,tds.create_user_name,tds.status,
-        tdss.stan_name
+        SELECT
+        tdb.stan_id,
+        tdb.stan_code,
+        tdb.stan_name,
+        tdb.stan_desc,
+        tdb.stan_type,
+        tdb.status,
+        tdb.sort
+        FROM t_dic_standard AS tdb
+        INNER JOIN t_dic_standard AS tdbb ON tdb.parent_id = (SELECT stan_id
+        FROM t_dic_mapping
+        WHERE dic_id = #{dicId})
+        <if test=" stanName != null and stanName!='' ">
+            and tdb.stan_name like CONCAT('%',trim(#{stanName}),'%')
+        </if>
+        <if test=" stanCode != null and stanCode!='' ">
+            and tdb.stan_code like CONCAT('%',trim(#{stanCode}),'%')
+        </if>
+        <if test=" stanType != null and stanType!='' ">
+            and tdb.stan_type=#{stanType}
+        </if>
+    </select>
+    <select id="getFname" resultMap="BaseResultMap">
+        select stan_name
+        from t_dic_standard
+        where parent_id = '0'
+    </select>
+
+    <select id="getTDicStandard" parameterType="TDicStandard" resultMap="BaseResultMap">
+        SELECT tds.stan_id,
+               tds.stan_code,
+               tds.stan_name,
+               tds.stan_desc,
+               tds.stan_type,
+               tds.status,
+               tds.sort
         FROM t_dic_standard AS tds
-        INNER JOIN t_dic_standard tdss ON tds.parent_id=tdss.stan_id
-        <where>
-            <if test=" stanName != null and stanName!='' ">
-                and stan_name like CONCAT('%',trim(#{stanName}),'%')
-            </if>
-            <if test=" stanCode != null and stanCode!='' ">
-                and stan_code like CONCAT('%',trim(#{stanCode}),'%')
-            </if>
-            <if test=" stanType != null and stanType!='' ">
-                and stan_type=#{stanType}
-            </if>
-        </where>
+                 INNER JOIN t_dic_standard AS tdbb ON tdbb.stan_id = #{stanId}
+        where 1=1
+        <if test=" stanName != null and stanName!='' ">
+            and tds.stan_name like CONCAT('%',trim(#{stanName}),'%')
+        </if>
+        <if test=" stanCode != null and stanCode!='' ">
+            and tds.stan_code like CONCAT('%',trim(#{stanCode}),'%')
+        </if>
+        <if test=" stanType != null and stanType!='' ">
+            and tds.stan_type=#{stanType}
+        </if>
     </select>
 
 </mapper>