123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?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.bz.smart_city.dao.InspectionStandardMapper">
- <!--auto generated Code-->
- <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.InspectionStandard">
- <result column="id" property="id" jdbcType="INTEGER"/>
- <result column="standard_name" property="standardName" jdbcType="VARCHAR"/>
- <result column="status" property="status" jdbcType="INTEGER"/>
- <result column="date_create" property="dateCreate" jdbcType="TIMESTAMP"/>
- <result column="date_update" property="dateUpdate" jdbcType="TIMESTAMP"/>
- <result column="create_by" property="createBy" jdbcType="VARCHAR"/>
- <result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
- <result column="site_id" property="siteId" jdbcType="INTEGER"/>
- </resultMap>
- <!--auto generated Code-->
- <sql id="Base_Column_List">
- id,
- standard_name,
- status,
- date_create,
- date_update,
- create_by,
- update_by,
- site_id
- </sql>
- <!--auto generated Code-->
- <insert id="insert" useGeneratedKeys="true" keyProperty="inspectionStandard.id">
- INSERT INTO sc_inspection_standard (
- id,
- standard_name,
- status,
- date_create,
- date_update,
- create_by,
- update_by,
- site_id
- ) VALUES (
- #{inspectionStandard.id,jdbcType=INTEGER},
- #{inspectionStandard.standardName,jdbcType=VARCHAR},
- #{inspectionStandard.status,jdbcType=INTEGER},
- #{inspectionStandard.dateCreate,jdbcType=TIMESTAMP},
- #{inspectionStandard.dateUpdate,jdbcType=TIMESTAMP},
- #{inspectionStandard.createBy,jdbcType=VARCHAR},
- #{inspectionStandard.updateBy,jdbcType=VARCHAR},
- #{inspectionStandard.siteId,jdbcType=INTEGER}
- )
- </insert>
- <!--auto generated Code-->
- <insert id="insertSelective" useGeneratedKeys="true" keyProperty="inspectionStandard.id">
- INSERT INTO sc_inspection_standard
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="inspectionStandard.id!=null"> id,</if>
- <if test="inspectionStandard.standardName!=null"> standard_name,</if>
- <if test="inspectionStandard.status!=null"> status,</if>
- <if test="inspectionStandard.dateCreate!=null"> date_create,</if>
- <if test="inspectionStandard.dateUpdate!=null"> date_update,</if>
- <if test="inspectionStandard.createBy!=null"> create_by,</if>
- <if test="inspectionStandard.updateBy!=null"> update_by,</if>
- <if test="inspectionStandard.siteId!=null"> site_id</if>
- </trim>
- VALUES
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="inspectionStandard.id!=null"> #{inspectionStandard.id,jdbcType=INTEGER},</if>
- <if test="inspectionStandard.standardName!=null"> #{inspectionStandard.standardName,jdbcType=VARCHAR},</if>
- <if test="inspectionStandard.status!=null"> #{inspectionStandard.status,jdbcType=INTEGER},</if>
- <if test="inspectionStandard.dateCreate!=null"> #{inspectionStandard.dateCreate,jdbcType=TIMESTAMP},</if>
- <if test="inspectionStandard.dateUpdate!=null"> #{inspectionStandard.dateUpdate,jdbcType=TIMESTAMP},</if>
- <if test="inspectionStandard.createBy!=null"> #{inspectionStandard.createBy,jdbcType=VARCHAR},</if>
- <if test="inspectionStandard.updateBy!=null"> #{inspectionStandard.updateBy,jdbcType=VARCHAR},</if>
- <if test="inspectionStandard.siteId!=null"> #{inspectionStandard.siteId,jdbcType=INTEGER}</if>
- </trim>
- </insert>
- <!--auto generated Code-->
- <insert id="insertList">
- INSERT INTO sc_inspection_standard(
- id,
- standard_name,
- status,
- date_create,
- date_update,
- create_by,
- update_by,
- site_id
- )VALUES
- <foreach collection="inspectionStandards" item="inspectionStandard" index="index" separator=",">
- (
- #{inspectionStandard.id,jdbcType=INTEGER},
- #{inspectionStandard.standardName,jdbcType=VARCHAR},
- #{inspectionStandard.status,jdbcType=INTEGER},
- #{inspectionStandard.dateCreate,jdbcType=TIMESTAMP},
- #{inspectionStandard.dateUpdate,jdbcType=TIMESTAMP},
- #{inspectionStandard.createBy,jdbcType=VARCHAR},
- #{inspectionStandard.updateBy,jdbcType=VARCHAR},
- #{inspectionStandard.siteId,jdbcType=INTEGER}
- )
- </foreach>
- </insert>
- <!--auto generated Code-->
- <update id="updateByPrimaryKeySelective">
- UPDATE sc_inspection_standard
- <set>
- <if test="inspectionStandard.id != null"> id = #{inspectionStandard.id,jdbcType=INTEGER},</if>
- <if test="inspectionStandard.standardName != null"> standard_name = #{inspectionStandard.standardName,jdbcType=VARCHAR},</if>
- <if test="inspectionStandard.status != null"> status = #{inspectionStandard.status,jdbcType=INTEGER},</if>
- <if test="inspectionStandard.dateCreate != null"> date_create = #{inspectionStandard.dateCreate,jdbcType=TIMESTAMP},</if>
- <if test="inspectionStandard.dateUpdate != null"> date_update = #{inspectionStandard.dateUpdate,jdbcType=TIMESTAMP},</if>
- <if test="inspectionStandard.createBy != null"> create_by = #{inspectionStandard.createBy,jdbcType=VARCHAR},</if>
- <if test="inspectionStandard.updateBy != null"> update_by = #{inspectionStandard.updateBy,jdbcType=VARCHAR},</if>
- <if test="inspectionStandard.siteId != null"> site_id = #{inspectionStandard.siteId,jdbcType=INTEGER}</if>
- </set>
- WHERE id = #{inspectionStandard.id,jdbcType=INTEGER}
- </update>
- <select id="findByNameUnique" resultType="java.lang.Integer">
- select count(1) from sc_inspection_standard
- where status = 1 and standard_name = #{standardName} and site_id = #{siteId}
- <if test="id != null"> and id != #{id}</if>
- </select>
- <select id="getList" resultType="com.bz.smart_city.dto.InspectionStandardDto">
- select <include refid="Base_Column_List"/> from sc_inspection_standard
- where status = 1
- <if test="siteId != null"> and site_id = #{siteId} </if>
- <if test="name != null and name != ''"> AND standard_name LIKE concat('%',#{name},'%')</if>
- order by date_create desc
- </select>
- </mapper>
|