123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
- <mapper namespace="com.sundata.internalevaluation.configuration.mapper.SysReqRulesMapper">
- <resultMap id="BaseResultMap" type="com.sundata.internalevaluation.configuration.model.SysReqRules">
- <result column="BELONG_PRODUCT" property="belongProduct"/>
- <result column="RULES_CONCLUSION_TEMPLATE" property="rulesConclusionTemplate"/>
- <result column="RULES_NO" property="rulesNo"/>
- <result column="RULES_NAME" property="rulesName"/>
- </resultMap>
- <resultMap id="detailResultMap" type="com.sundata.internalevaluation.configuration.model.SysReqRules" extends="BaseResultMap">
- <collection column="guize_no" ofType="java.lang.String" property="ruleIds"/>
- <!-- <collection column="guize_no" ofType="java.lang.String" property="ruleIds"/>-->
- </resultMap>
- <!-- 表字段 -->
- <sql id="baseColumns">
- t.BELONG_PRODUCT,
- t.RULES_NO,
- t.RULES_NAME
- -- , t.RULE_IDS
- </sql>
- <!-- 查询全部 -->
- <select id="listAll" resultMap="BaseResultMap">
- SELECT
- t.BELONG_PRODUCT,
- t.RULES_NO,
- t.RULES_NAME
- FROM SYS_REQ_RULES t
- <where>
- <if test="rulesNo != null and rulesNo != ''">
- AND rules_No like concat(concat('%',#{rulesNo}),'%')
- </if>
- <if test="rulesName != null and rulesName != ''">
- AND rules_Name like concat(concat('%',#{rulesName}),'%')
- </if>
- <if test="belongProduct != null and belongProduct != ''">
- AND belong_Product like concat(concat('%',#{belongProduct}),'%')
- </if>
- </where>
- </select>
- <!-- 根据主键获取单条记录 -->
- <!--
- SELECT
- r.rules_no,
- r.rules_name,
- r.BELONG_PRODUCT,
- rr.rule_no as guize_no
- FROM SYS_REQ_RULES r
- left join SYS_REQ_RULE_RULES rr on r.rules_no = rr.rules_no
- WHERE r.RULES_NO = #{rulesNo}
- -->
- <!-- <select id="getById" resultMap="detailResultMap" parameterType="java.lang.String">-->
- <select id="getById" resultMap="BaseResultMap" parameterType="java.lang.String">
- SELECT
- r.rules_no,
- r.rules_name,
- r.rules_Conclusion_Template,
- r.BELONG_PRODUCT
- FROM SYS_REQ_RULES r
- WHERE r.RULES_NO = #{rulesNo}
- </select>
- <select id="selectRuleByRulesNo" resultType="java.lang.String" parameterType="java.lang.String">
- select rule_no from SYS_REQ_RULE_RULES where RULES_NO = #{rulesNo}
- </select>
- <select id="selectRulesByRuleNo" resultType="java.lang.String" parameterType="java.lang.String">
- select rules_no from SYS_REQ_RULE_RULES where RULE_NO = #{ruleNo}
- </select>
- <!-- 插入不为NULL的字段 -->
- <insert id="insertIgnoreNull" parameterType="com.sundata.internalevaluation.configuration.model.SysReqRules"
- keyProperty="rulesNo" keyColumn="RULES_NO" useGeneratedKeys="true"
- >
- INSERT INTO SYS_REQ_RULES
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="belongProduct != null">
- BELONG_PRODUCT,
- </if>
- <if test="rulesConclusionTemplate != null">
- rules_Conclusion_Template,
- </if>
- <if test="rulesNo != null">
- RULES_NO,
- </if>
- <if test="rulesName != null">
- RULES_NAME,
- </if>
- <!-- <if test="ruleIds != null">-->
- <!-- RULE_IDS,-->
- <!-- </if>-->
- </trim>
- <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
- <if test="belongProduct != null">
- #{belongProduct},
- </if>
- <if test="rulesConclusionTemplate != null">
- #{rulesConclusionTemplate},
- </if>
- <if test="rulesNo != null">
- #{rulesNo},
- </if>
- <if test="rulesName != null">
- #{rulesName},
- </if>
- <!-- <if test="ruleIds != null">-->
- <!-- #{ruleIds},-->
- <!-- </if>-->
- </trim>
- </insert>
- <!-- 更新不为NULL的字段 -->
- <update id="updateIgnoreNull" parameterType="com.sundata.internalevaluation.configuration.model.SysReqRules">
- UPDATE SYS_REQ_RULES
- <set>
- <if test="belongProduct != null">
- BELONG_PRODUCT=#{belongProduct},
- </if>
- <if test="rulesConclusionTemplate != null">
- rules_Conclusion_Template=#{rulesConclusionTemplate},
- </if>
- <if test="rulesName != null">
- RULES_NAME=#{rulesName},
- </if>
- <!-- <if test="ruleIds != null">-->
- <!-- RULE_IDS=#{ruleIds},-->
- <!-- </if>-->
- </set>
- WHERE RULES_NO = #{rulesNo}
- </update>
- <!-- 根据主键删除记录 -->
- <delete id="delete" parameterType="com.sundata.internalevaluation.configuration.model.SysReqRules">
- delete
- from sys_req_rules
- WHERE RULES_NO = #{rulesNo}
- </delete>
- <delete id="deleteAssociateRuleByRulesNo" parameterType="java.lang.String">
- delete
- from sys_req_rule_rules
- WHERE RULES_NO = #{rulesNo}
- </delete>
- <insert id="insertAssociateRule"
- parameterType="java.util.List">
- INSERT ALL
- <foreach collection="associateRules" index="id" item="item">
- INTO sys_req_rule_rules(RULE_NO, RULES_NO)
- VALUES ( #{item.ruleNo}, #{item.rulesNo})
- </foreach>
- SELECT 1 FROM dual
- </insert>
- <!-- 规则集生成字典 -->
- <select id="selectRulesToDictContent" resultType="com.sundata.admin.nounmanage.model.DictContent">
- select RULES_NO as id, RULES_NAME as text from SYS_REQ_RULES
- </select>
- </mapper>
|