123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- <?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.AppMapper">
- <resultMap id="AppDtoResultMap" type="com.zhyc.xps.sys.dto.AppDto" >
- <result column="app_id" property="appId" jdbcType="BIGINT" /><!--App ID-->
- <result column="app_cat_id" property="appCatId" jdbcType="BIGINT" />
- <result column="app_cat_title" property="appCatTitle" jdbcType="VARCHAR"/>
- <result column="app_title" property="appTitle" jdbcType="VARCHAR"/>
- <result column="app_code" property="appCode" jdbcType="VARCHAR"/>
- <result column="app_desc" property="appDesc" jdbcType="VARCHAR"/>
- <result column="app_logo" property="appLogo" jdbcType="VARCHAR"/>
- <result column="app_url" property="appUrl" jdbcType="VARCHAR"/>
- <result column="app_param" property="appParam" jdbcType="VARCHAR"/>
- <result column="app_desc" property="appDesc" jdbcType="VARCHAR"/>
- <result column="status" property="status" jdbcType="BIGINT" />
- <result column="if_store" property="ifStore" jdbcType="BIGINT" />
- </resultMap>
- <sql id="AppDto_Cols">
- A.app_id,
- A.app_cat_id,
- B.app_cat_title,
- A.app_desc,
- A.app_code,
- A.app_title,
- A.app_url,
- A.app_param,
- A.app_logo,
- A.status,
- A.if_store
- </sql>
- <!--基于ID查询-->
- <select id="getById" resultMap="AppDtoResultMap">
- SELECT
- <include refid="AppDto_Cols"/>
- FROM app AS A
- LEFT JOIN app_cat AS B ON (A.app_cat_id = B.app_cat_id)
- WHERE A.app_id = #{appId ,jdbcType=BIGINT} AND A.deleted_flag = 0
- </select>
- <!--基于Key查询-->
- <select id="getByCode" resultMap="AppDtoResultMap">
- SELECT
- <include refid="AppDto_Cols"/>
- FROM app AS A
- LEFT JOIN app_cat AS B ON (A.app_cat_id = B.app_cat_id)
- WHERE A.app_code = #{appCode ,jdbcType=VARCHAR} AND A.deleted_flag = 0
- </select>
- <!--列表查询-->
- <select id="getByList" parameterType="java.util.Map" resultMap="AppDtoResultMap">
- SELECT
- <include refid="AppDto_Cols"/>
- FROM app AS A
- LEFT JOIN app_cat AS B ON (A.app_cat_id = B.app_cat_id)
- WHERE A.deleted_flag = 0
- <if test="appId !=null">
- AND A.app_id = #{appId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND A.app_title like "%"#{keyword}"%"
- </if>
- <if test="appCatId != null">
- AND A.app_cat_id = #{appCatId ,jdbcType=BIGINT}
- </if>
- <if test="status != null">
- AND A.status = #{status ,jdbcType=BIGINT}
- </if>
- <if test="ifStore != null">
- AND A.if_store = #{ifStore ,jdbcType=BIGINT}
- </if>
- ORDER BY A.app_id ASC
- </select>
- <!--分页查询-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="AppDtoResultMap">
- SELECT
- <include refid="AppDto_Cols"/>
- FROM app AS A
- LEFT JOIN app_cat AS B ON (A.app_cat_id = B.app_cat_id)
- WHERE A.deleted_flag = 0
- <if test="appId !=null">
- AND A.app_id = #{appId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND A.app_title like "%"#{keyword}"%"
- </if>
- <if test="appCatId != null">
- AND A.app_cat_id = #{appCatId ,jdbcType=BIGINT}
- </if>
- <if test="status != null">
- AND A.status = #{status ,jdbcType=BIGINT}
- </if>
- ORDER BY A.app_id ASC
- </select>
- <!--新增-->
- <insert id="create" parameterType="com.zhyc.xps.sys.entity.App" keyProperty="appId">
- INSERT INTO app
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="appId != null">
- app_id,
- </if>
- <if test="appCatId != null">
- app_cat_id,
- </if>
- <if test="appTitle != null and appTitle!=''">
- app_title,
- </if>
- <if test="appCode!= null and appCode!=''">
- app_code,
- </if>
- <if test="appDesc != null and appDesc != ''">
- app_desc,
- </if>
- <if test="appLogo != null and appLogo != ''">
- app_logo,
- </if>
- <if test="appUrl != null and appUrl != ''">
- app_url,
- </if>
- <if test="appParam != null and appParam != ''">
- app_param,
- </if>
- <if test="status != null">
- status,
- </if>
- <if test="ifStore != null">
- if_store,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="appId != null">
- #{appId ,jdbcType=BIGINT},
- </if>
- <if test="appCatId != null">
- #{appCatId ,jdbcType=BIGINT},
- </if>
- <if test="appTitle != null and appTitle!=''">
- #{appTitle ,jdbcType=VARCHAR},
- </if>
- <if test="appCode!= null and appCode!=''">
- #{appCode ,jdbcType=VARCHAR},
- </if>
- <if test="appDesc != null and appDesc != ''">
- #{appDesc ,jdbcType=VARCHAR},
- </if>
- <if test="appLogo != null and appLogo != ''">
- #{appLogo ,jdbcType=VARCHAR},
- </if>
- <if test="appUrl != null and appUrl != ''">
- #{appUrl ,jdbcType=VARCHAR},
- </if>
- <if test="appParam != null and appParam != ''">
- #{appParam ,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- #{status ,jdbcType=BIGINT},
- </if>
- <if test="ifStore != null">
- #{ifStore ,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.sys.entity.App">
- UPDATE app
- <trim suffixOverrides=",">
- <set>
- <if test="appCatId != null">
- app_cat_id = #{appCatId ,jdbcType=BIGINT},
- </if>
- <if test="appTitle != null and appTitle != ''">
- app_title =#{appTitle ,jdbcType=VARCHAR},
- </if>
- <if test="appCode!= null and appCode!=''">
- app_code = #{appCode ,jdbcType=VARCHAR},
- </if>
- <if test="appDesc != null">
- app_desc = #{appDesc ,jdbcType=VARCHAR},
- </if>
- <if test="appLogo != null and appLogo != ''">
- app_logo = #{appLogo ,jdbcType=VARCHAR},
- </if>
- <if test="appUrl != null and appUrl != ''">
- app_url = #{appUrl ,jdbcType=VARCHAR},
- </if>
- <if test="appParam != null">
- app_param = #{appParam ,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- status = #{status ,jdbcType=BIGINT},
- </if>
- <if test="ifStore != null">
- if_store = #{ifStore ,jdbcType=BIGINT},
- </if>
- <if test="updatedBy != null">
- updated_by = #{updatedBy ,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
- </if>
- </set>
- </trim>
- WHERE app_id = #{appId, jdbcType=BIGINT}
- </update>
- <!--删除 -->
- <update id="delete" parameterType="java.util.Map">
- UPDATE app
- <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 app_id = #{appId, jdbcType=BIGINT}
- </update>
- </mapper>
|