Browse Source

修改映射返回父级编码

guxinyu 2 years ago
parent
commit
70a3b86357

BIN
cbkj_web_parameter/src/main/java/com/jiuzhekan/cbkj/mapper/dic/TDicStandardMapper.java


BIN
cbkj_web_parameter/src/main/java/com/jiuzhekan/cbkj/service/dic/TDicBaseService.java


+ 16 - 9
cbkj_web_parameter/src/main/resources/mappers/dic/TDicStandardMapper.xml

@@ -105,28 +105,35 @@
         FROM t_dic_mapping
         WHERE dic_id = #{dicId})
         <if test="keyWord !=null and keyWord!='' ">
-            and (tdb.stan_name like CONCAT('%',trim(#{keyWord}),'%') or tdb.stan_code like CONCAT('%',trim(#{keyWord}),'%') )
+            and (tdb.stan_name like CONCAT('%',trim(#{keyWord}),'%') or tdb.stan_code like
+            CONCAT('%',trim(#{keyWord}),'%') )
         </if>
         <if test=" stanType != null and stanType!='' ">
             and tdb.stan_type=#{stanType}
         </if>
     </select>
     <select id="getFname" resultMap="BaseResultMap">
-        select stan_id,stan_name,stan_code
+        select stan_id, stan_name, stan_code
         from t_dic_standard
         where parent_id = '0'
     </select>
+    <select id="getFCode" parameterType="TDicStandard" resultMap="BaseResultMap">
+        SELECT stan_code
+        FROM t_dic_standard AS tdb
+        LEFT JOIN t_dic_mapping AS tdm ON tdb.`stan_id` = (SELECT stan_id FROM t_dic_mapping WHERE dic_id =#{dicId})
+        WHERE tdb.`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
+        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 AS tdbb ON tdbb.stan_id = #{stanId}
+        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}),'%')