123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- <?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.aqpt.mapper.EquipmentMapper">
- <resultMap id="EquipmentDtoMap" type="com.zhyc.xps.aqpt.dto.EquipmentDto">
- <result column="oc_id" property="ocId" jdbcType="BIGINT" />
- <result column="equip_id" property="equipId" jdbcType="BIGINT" />
- <result column="group_id" property="groupId" jdbcType="BIGINT" />
- <result column="group_name" property="groupName" jdbcType="VARCHAR" />
- <result column="equip_title" property="equipTitle" jdbcType="VARCHAR" />
- <result column="equip_code" property="equipCode" jdbcType="VARCHAR" />
- <result column="equip_cat_id" property="equipCatId" jdbcType="BIGINT" />
- <result column="equip_cat_title" property="equipCatTitle" jdbcType="VARCHAR" />
- <result column="equip_desc" property="equipDesc" jdbcType="VARCHAR" />
- <result column="status" property="status" jdbcType="BIGINT" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="EquipmentDto_Cols">
- A.oc_id,
- A.group_id,
- C.group_name,
- A.equip_id,
- A.equip_title,
- A.equip_code,
- A.equip_cat_id,
- B.equip_cat_title,
- A.equip_desc,
- A.status
- </sql>
- <!--基于ID查询-->
- <select id="getById" resultMap="EquipmentDtoMap">
- SELECT
- <include refid="EquipmentDto_Cols"/>
- FROM equipment AS A
- LEFT JOIN equipment_cat AS B ON (A.oc_id = B.oc_id AND A.equip_cat_id = B.equip_cat_id)
- LEFT JOIN s_group AS C ON (A.oc_id = C.oc_id AND A.group_id = C.group_id)
- WHERE A.deleted_flag = 0
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- AND A.equip_id = #{equipId ,jdbcType=BIGINT}
- </select>
- <!--基于Code查询-->
- <select id="getByCode" resultMap="EquipmentDtoMap">
- SELECT
- <include refid="EquipmentDto_Cols"/>
- FROM equipment AS A
- LEFT JOIN equipment_cat AS B ON (A.oc_id = B.oc_id AND A.equip_cat_id = B.equip_cat_id)
- LEFT JOIN s_group AS C ON (A.oc_id = C.oc_id AND A.group_id = C.group_id)
- WHERE A.deleted_flag = 0
- AND A.oc_id = #{ocId, jdbcType=BIGINT}
- AND A.equip_code = #{equipCode, jdbcType=VARCHAR}
- </select>
- <!--分页查询信息-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="EquipmentDtoMap">
- SELECT
- <include refid="EquipmentDto_Cols"/>
- FROM equipment AS A
- LEFT JOIN equipment_cat AS B ON (A.oc_id = B.oc_id AND A.equip_cat_id = B.equip_cat_id)
- LEFT JOIN s_group AS C ON (A.oc_id = C.oc_id AND A.group_id = C.group_id)
- WHERE 1 = 1 AND A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="equipCatId != null">
- AND A.equip_cat_id = #{equipCatId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- and A.equip_title like "%"#{keywords}"%"
- </if>
- ORDER BY A.equip_id ASC
- </select>
- <select id="getByList" parameterType="java.util.Map" resultMap="EquipmentDtoMap">
- SELECT
- <include refid="EquipmentDto_Cols"/>
- FROM equipment AS A
- LEFT JOIN equipment_cat AS B ON (A.oc_id = B.oc_id AND A.equip_cat_id = B.equip_cat_id)
- LEFT JOIN s_group AS C ON (A.oc_id = C.oc_id AND A.group_id = C.group_id)
- WHERE 1 = 1 AND A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="equipCatId != null">
- AND A.equip_cat_id = #{equipCatId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND A.equip_title like "%"#{keywords}"%"
- </if>
- ORDER BY A.equip_id ASC
- </select>
- <insert id="create" parameterType="com.zhyc.xps.aqpt.entity.Equipment">
- INSERT INTO equipment
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="groupId != null">
- group_id,
- </if>
- <if test="equipId != null">
- equip_id,
- </if>
- <if test="equipTitle != null and equipTitle != ''">
- equip_title,
- </if>
- <if test="equipCode != null and equipCode != ''">
- equip_code,
- </if>
- <if test="equipDesc != null and equipDesc !=''">
- equip_desc,
- </if>
- <if test="equipCatId != null">
- equip_cat_id,
- </if>
- <if test="status != null">
- status,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- #{ocId ,jdbcType=BIGINT},
- </if>
- <if test="groupId != null">
- #{groupId ,jdbcType=BIGINT},
- </if>
- <if test="equipId != null">
- #{equipId ,jdbcType=BIGINT},
- </if>
- <if test="equipTitle != null and equipTitle != ''">
- #{equipTitle ,jdbcType=VARCHAR},
- </if>
- <if test="equipCode != null and equipCode != ''">
- #{equipCode ,jdbcType=VARCHAR},
- </if>
- <if test="equipDesc != null and equipDesc != ''">
- #{equipDesc ,jdbcType=BIGINT},
- </if>
- <if test="equipCatId != null">
- #{equipCatId ,jdbcType=BIGINT},
- </if>
- <if test="status != null">
- #{status ,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.aqpt.entity.Equipment">
- UPDATE equipment
- <trim suffixOverrides=",">
- <set>
- <if test="groupId != null">
- group_id = #{groupId ,jdbcType=BIGINT},
- </if>
- <if test="equipTitle != null and equipTitle != ''">
- equip_title = #{equipTitle, jdbcType=VARCHAR},
- </if>
- <if test="equipCode != null and equipCode != ''">
- equip_code = #{equipCode, jdbcType=VARCHAR},
- </if>
- <if test="equipDesc != null and equipDesc != ''">
- equip_desc = #{equipDesc ,jdbcType=VARCHAR},
- </if>
- <if test="equipCatId != null">
- equip_cat_id = #{equipCatId ,jdbcType=BIGINT},
- </if>
- <if test="status != null">
- status = #{status ,jdbcType=BIGINT},
- </if>
- <if test="updatedBy != null ">
- updated_by = #{updatedBy ,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
- </if>
- <if test="layerId != null">
- layer_id = #{layerId ,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="equipId != null">
- AND equip_id = #{equipId ,jdbcType=BIGINT}
- </if>
- </update>
- <!--删除-->
- <update id="delete" parameterType="java.util.Map">
- UPDATE equipment
- <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="equipId != null">
- AND equip_id = #{equipId ,jdbcType=BIGINT}
- </if>
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- </update>
- </mapper>
|