123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <?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.sys.mapper.JobMapper">
- <resultMap id="JobDtoResultMap" type="com.zhyc.xps.sys.dto.JobDto">
- <result column="job_id" property="jobId" jdbcType="BIGINT" />
- <result column="job_title" property="jobTitle" jdbcType="VARCHAR" />
- <result column="job_desc" property="jobDesc" jdbcType="VARCHAR" />
- <result column="job_type" property="jobType" jdbcType="BIGINT" />
- <result column="status" property="status" jdbcType="BIGINT" />
- <result column="job_code" property="jobCode" jdbcType="VARCHAR" />
- <result column="job_cron" property="jobCron" jdbcType="VARCHAR" />
- <result column="job_class_id" property="jobClassId" jdbcType="BIGINT" />
- <result column="job_class" property="jobClass" jdbcType="VARCHAR" />
- <result column="cycle_title" property="cycleTitle" jdbcType="VARCHAR" />
- <result column="cycle_period" property="cyclePeriod" jdbcType="BIGINT" />
- <result column="cycle_unit" property="cycleUnit" jdbcType="BIGINT" />
- </resultMap>
- <sql id="JobDto_Cols">
- A.job_id,
- A.job_title,
- A.job_desc,
- A.status,
- A.job_type,
- A.job_code,
- A.job_cron,
- A.job_class_id,
- B.job_class,
- A.cycle_title,
- A.cycle_period,
- A.cycle_unit
- </sql>
- <!--基于ID查询-->
- <select id="getById" parameterType="java.lang.Long" resultMap="JobDtoResultMap">
- SELECT
- <include refid="JobDto_Cols"/>
- FROM job AS A
- LEFT JOIN job_class AS B ON (A.job_class_id = B.job_class_id)
- WHERE A.job_id = #{jobId, jdbcType=BIGINT}
- </select>
- <!--分页查询-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="JobDtoResultMap">
- SELECT
- <include refid="JobDto_Cols"/>
- FROM job AS A
- LEFT JOIN job_class AS B ON (A.job_class_id = B.job_class_id)
- WHERE A.deleted_flag = 0
- <if test="keywords != null and keywords != ''">
- AND A.job_title like "%"#{keywords}"%"
- </if>
- <if test="status != null">
- AND A.status = #{status, jdbcType=BIGINT}
- </if>
- <if test="jobClassId != null">
- AND A.job_class_id = #{jobClassId, jdbcType=BIGINT}
- </if>
- ORDER BY A.job_id ASC
- </select>
- <!--列表查询-->
- <select id="getByList" parameterType="java.util.Map" resultMap="JobDtoResultMap" >
- SELECT
- <include refid="JobDto_Cols"/>
- FROM job AS A
- LEFT JOIN job_class AS B ON (A.job_class_id = B.job_class_id)
- WHERE A.deleted_flag = 0
- <if test="keywords != null and keywords != ''">
- AND A.job_title like "%"#{keywords}"%"
- </if>
- <if test="status != null">
- AND A.status = #{status, jdbcType=BIGINT}
- </if>
- <if test="jobClassId != null">
- AND A.job_class_id = #{jobClassId, jdbcType=BIGINT}
- </if>
- ORDER BY A.job_id ASC
- </select>
- <!--新增-->
- <insert id="create" useGeneratedKeys="true" keyProperty="jobId" parameterType="com.zhyc.xps.sys.entity.Job">
- INSERT INTO job
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="jobId != null">
- job_id,
- </if>
- <if test="jobTitle != null and jobTitle != ''">
- job_title,
- </if>
- <if test="jobDesc != null and jobDesc != ''">
- job_desc,
- </if>
- <if test="status != null">
- status,
- </if>
- <if test="jobType != null">
- job_type,
- </if>
- <if test="jobCode != null and jobCode !=''">
- job_code,
- </if>
- <if test="jobCron != null and jobCron !=''">
- job_cron,
- </if>
- <if test="jobClassId != null">
- job_class_id,
- </if>
- <if test="cycleTitle != null">
- cycle_title,
- </if>
- <if test="cyclePeriod != null">
- cycle_period,
- </if>
- <if test="cycleUnit != null">
- cycle_unit,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="jobId != null">
- #{jobId, jdbcType=BIGINT},
- </if>
- <if test="jobTitle != null and jobTitle != ''">
- #{jobTitle, jdbcType=VARCHAR},
- </if>
- <if test="jobDesc != null and jobDesc != ''">
- #{jobDesc, jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- #{status, jdbcType=BIGINT},
- </if>
- <if test="jobType != null">
- #{jobType, jdbcType=BIGINT},
- </if>
- <if test="jobCode != null and jobCode != ''">
- #{jobCode,jdbcType=VARCHAR},
- </if>
- <if test="jobCron != null and jobCron != ''">
- #{jobCron, jdbcType=VARCHAR},
- </if>
- <if test="jobClassId != null">
- #{jobClassId,jdbcType=BIGINT},
- </if>
- <if test="cycleTitle != null and cycleTitle != ''">
- #{cycleTitle, jdbcType=BIGINT},
- </if>
- <if test="cyclePeriod != null">
- #{cyclePeriod, jdbcType=BIGINT},
- </if>
- <if test="cycleUnit != null">
- #{cycleUnit, jdbcType=BIGINT},
- </if>
- <if test="createdBy != null">
- #{createdBy,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt,jdbcType=DATE},
- </if>
- </trim>
- </insert>
- <!--更新-->
- <update id="update" parameterType="com.zhyc.xps.sys.entity.Job">
- UPDATE job
- <trim suffixOverrides=",">
- <set>
- <if test="jobTitle != null and jobTitle != ''">
- job_title = #{jobTitle, jdbcType=VARCHAR},
- </if>
- <if test="jobDesc != null and jobDesc != ''">
- job_desc = #{jobDesc, jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- status = #{status, jdbcType=BIGINT},
- </if>
- <if test="jobType != null">
- job_type = #{jobType, jdbcType=BIGINT},
- </if>
- <if test="jobCode != null and jobCode !=''">
- job_code = #{jobCode, jdbcType=VARCHAR},
- </if>
- <if test="jobCron != null and jobCron !=''">
- job_cron = #{jobCron, jdbcType=VARCHAR},
- </if>
- <if test="jobClassId != null">
- job_class_id = #{jobClassId,jdbcType=BIGINT},
- </if>
- <if test="cycleTitle != null and cycleTitle !=''">
- cycle_title = #{cycleTitle, jdbcType=VARCHAR},
- </if>
- <if test="cyclePeriod != null">
- cycle_period = #{cyclePeriod, jdbcType=BIGINT},
- </if>
- <if test="cycleUnit != null">
- cycle_unit = #{cycleUnit, jdbcType=BIGINT},
- </if>
- <if test="updatedBy != null">
- updated_by = #{updatedBy,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt,jdbcType=DATE},
- </if>
- </set>
- </trim>
- WHERE job_id = #{jobId, jdbcType=BIGINT}
- </update>
- <!--删除 -->
- <update id="delete" parameterType="java.util.Map">
- UPDATE job
- <trim suffixOverrides=",">
- <set>
- <if test="deletedBy != null">
- deleted_by = #{deletedBy ,jdbcType=BIGINT},
- </if>
- <if test="deletedAt != null">
- deleted_at = #{deletedAt ,jdbcType=DATE},
- </if>
- <if test="deletedFlag != null">
- deleted_flag = #{deletedFlag ,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE job_id = #{jobId, jdbcType=BIGINT}
- </update>
- </mapper>
|