123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?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.zhyc.xps.lylc.mapper.AssessRuleMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="AssessRuleDtoResultMap" type="com.zhyc.xps.lylc.dto.AssessRuleDto">
- <result column="story_id" property="storyId" jdbcType="BIGINT" />
- <result column="story_title" property="storyTitle" jdbcType="VARCHAR" />
- <result column="rule_percent" property="rulePercent" jdbcType="BIGINT" />
- <result column="rule_desc" property="ruleDesc" jdbcType="VARCHAR" />
- <result column="is_fixed" property="isFixed" jdbcType="BIGINT" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="AssessRuleDto_Cols">
- A.story_id,
- B.story_title,
- A.rule_percent,
- A.is_fixed,
- A.rule_desc
- </sql>
- <!--基于ID查询-->
- <select id="getById" resultMap="AssessRuleDtoResultMap">
- SELECT
- <include refid="AssessRuleDto_Cols"/>
- FROM assess_rule AS A
- LEFT JOIN assess_story AS B ON (A.story_id = B.story_id)
- WHERE A.deleted_flag = 0
- <if test="storyId != null">
- AND A.story_id = #{storyId ,jdbcType=BIGINT}
- </if>
- </select>
- <!--分页查询-->
- <select id="getByPage" resultMap="AssessRuleDtoResultMap" parameterType="java.util.Map" >
- SELECT
- <include refid="AssessRuleDto_Cols"/>
- FROM assess_rule AS A
- LEFT JOIN assess_story AS B ON (A.story_id = B.story_id)
- WHERE A.deleted_flag = 0
- <if test="keywords != null and keywords != ''">
- and B.story_title like "%"#{keywords}"%"
- </if>
- ORDER BY A.story_id ASC
- </select>
- <!--列表查询-->
- <select id="getByList" resultMap="AssessRuleDtoResultMap" >
- SELECT
- <include refid="AssessRuleDto_Cols"/>
- FROM assess_rule AS A
- LEFT JOIN assess_story AS B ON (A.story_id = B.story_id)
- WHERE A.deleted_flag = 0
- </select>
- <insert id="create" parameterType="com.zhyc.xps.lylc.entity.AssessRule">
- INSERT INTO assess_rule
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="storyId != null">
- story_id,
- </if>
- <if test="rulePercent != null">
- rule_percent,
- </if>
- <if test="ruleDesc != null and ruleDesc != ''">
- rule_desc,
- </if>
- <if test="isFixed != null">
- is_fixed,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="storyId != null">
- #{storyId ,jdbcType=BIGINT},
- </if>
- <if test="rulePercent != null ">
- #{rulePercent ,jdbcType=BIGINT},
- </if>
- <if test="ruleDesc != null and ruleDesc != ''">
- #{ruleDesc ,jdbcType=VARCHAR},
- </if>
- <if test="isFixed != null">
- #{isFixed,jdbcType=BIGINT},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <!--更新-->
- <update id="update" parameterType="com.zhyc.xps.lylc.entity.AssessRule">
- UPDATE assess_rule
- <trim suffixOverrides=",">
- <set>
- <if test="rulePercent != null">
- rule_percent = #{rulePercent ,jdbcType=BIGINT},
- </if>
- <if test="ruleDesc != null and ruleDesc != ''">
- rule_desc = #{ruleDesc, jdbcType=VARCHAR},
- </if>
- <if test="updatedBy != null ">
- updated_by = #{updatedBy ,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
- </if>
- </set>
- </trim>
- WHERE 1 = 1
- <if test="storyId != null">
- AND story_id = #{storyId ,jdbcType=BIGINT}
- </if>
- </update>
- <!--删除-->
- <update id="delete" parameterType="java.util.Map">
- UPDATE assess_rule
- <trim suffixOverrides=",">
- <set>
- <if test="deletedFlag != null">
- deleted_flag = #{deletedFlag,jdbcType=BIGINT},
- </if>
- <if test="deletedTime != null">
- deleted_time = #{deletedTime,jdbcType=TIMESTAMP},
- </if>
- <if test="deletedBy != null">
- deleted_by = #{deletedBy,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE 1 = 1
- <if test="storyId != null">
- AND story_id = #{storyId ,jdbcType=BIGINT}
- </if>
- </update>
- </mapper>
|