yujian
2020-06-09 554de444b87aab5f93cb1593a8095612cf9479a7
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserCustomSettingsMapper.xml
@@ -1,119 +1,119 @@
<?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.yeshi.fanli.dao.mybatis.user.UserCustomSettingsMapper">
   <resultMap id="BaseResultMap"
      type="com.yeshi.fanli.entity.bus.user.UserCustomSettings">
      <id column="ucs_id" property="id" jdbcType="BIGINT" />
      <result column="ucs_type" property="type"
         typeHandler="com.yeshi.fanli.util.mybatishandler.UserSettingTypeEnumHandler" />
      <result column="ucs_state" property="state" jdbcType="INTEGER" />
      <result column="ucs_create_time" property="createTime"
         jdbcType="TIMESTAMP" />
      <result column="ucs_update_time" property="updateTime"
         jdbcType="TIMESTAMP" />
      <association property="userInfo" column="ucs_uid"
         javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
         <id column="ucs_uid" property="id" jdbcType="BIGINT" />
      </association>
   </resultMap>
   <sql id="Base_Column_List">ucs_id,ucs_uid,ucs_type,ucs_state,ucs_create_time,ucs_update_time
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_user_custom_settings where ucs_id =
      #{id,jdbcType=BIGINT}
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
      yeshi_ec_user_custom_settings where ucs_id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserCustomSettings"
      useGeneratedKeys="true" keyProperty="id">insert into
      yeshi_ec_user_custom_settings
      (ucs_id,ucs_uid,ucs_type,ucs_state,ucs_create_time,ucs_update_time)
      values
      (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserCustomSettings"
      useGeneratedKeys="true" keyProperty="id">
      insert into yeshi_ec_user_custom_settings
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">ucs_id,</if>
         <if test="userInfo != null">ucs_uid,</if>
         <if test="type != null">ucs_type,</if>
         <if test="state != null">ucs_state,</if>
         <if test="createTime != null">ucs_create_time,</if>
         <if test="updateTime != null">ucs_update_time,</if>
      </trim>
      values
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">#{id,jdbcType=BIGINT},</if>
         <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if>
         <if test="type != null">#{type,jdbcType=VARCHAR},</if>
         <if test="state != null">#{state,jdbcType=INTEGER},</if>
         <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
         <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
      </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserCustomSettings">update
      yeshi_ec_user_custom_settings set ucs_uid =
      #{userInfo.id,jdbcType=BIGINT},ucs_type =
      #{type,jdbcType=VARCHAR},ucs_state =
      #{state,jdbcType=INTEGER},ucs_create_time =
      #{createTime,jdbcType=TIMESTAMP},ucs_update_time =
      #{updateTime,jdbcType=TIMESTAMP} where ucs_id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserCustomSettings">
      update yeshi_ec_user_custom_settings
      <set>
         <if test="userInfo != null">ucs_uid=#{userInfo.id,jdbcType=BIGINT},</if>
         <if test="type != null">ucs_type=#{type,jdbcType=VARCHAR},</if>
         <if test="state != null">ucs_state=#{state,jdbcType=INTEGER},</if>
         <if test="createTime != null">ucs_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
         <if test="updateTime != null">ucs_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
      </set>
      where ucs_id = #{id,jdbcType=BIGINT}
   </update>
   <select id="getSettingsByUid" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      SELECT * FROM yeshi_ec_user_custom_settings
      WHERE ucs_uid
      = #{uid,jdbcType=BIGINT}
   </select>
   <select id="getSettingsByUidAndType" resultMap="BaseResultMap">
      SELECT * FROM
      yeshi_ec_user_custom_settings
      WHERE ucs_uid = #{uid} AND
      ucs_type=#{type}
   </select>
   <select id="getUserID" resultType="java.lang.Long">
      SELECT ucs_uid FROM
      yeshi_ec_user_custom_settings
      WHERE ucs_state= 1 AND ucs_type=#{type}
   </select>
   <select id="listByUidListAndTypeAndState" resultMap="BaseResultMap">
      SELECT ucs_uid FROM yeshi_ec_user_custom_settings
      WHERE
      ucs_type=#{type}
      <if test="state!=null">
         and ucs_state=#{state}
      </if>
      <if test="uidList!=null">
         <foreach collection="uidList" item="uid" open=" and (" close=")"
            separator=" or ">
            ucs_uid=#{uid}
         </foreach>
      </if>
   </select>
</mapper>
<?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.yeshi.fanli.dao.mybatis.user.UserCustomSettingsMapper">
   <resultMap id="BaseResultMap"
      type="com.yeshi.fanli.entity.bus.user.UserCustomSettings">
      <id column="ucs_id" property="id" jdbcType="BIGINT" />
      <result column="ucs_type" property="type"
         typeHandler="com.yeshi.fanli.util.mybatishandler.UserSettingTypeEnumHandler" />
      <result column="ucs_state" property="state" jdbcType="INTEGER" />
      <result column="ucs_create_time" property="createTime"
         jdbcType="TIMESTAMP" />
      <result column="ucs_update_time" property="updateTime"
         jdbcType="TIMESTAMP" />
      <association property="userInfo" column="ucs_uid"
         javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
         <id column="ucs_uid" property="id" jdbcType="BIGINT" />
      </association>
   </resultMap>
   <sql id="Base_Column_List">ucs_id,ucs_uid,ucs_type,ucs_state,ucs_create_time,ucs_update_time
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_user_custom_settings where ucs_id =
      #{id,jdbcType=BIGINT}
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
      yeshi_ec_user_custom_settings where ucs_id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserCustomSettings"
      useGeneratedKeys="true" keyProperty="id">insert into
      yeshi_ec_user_custom_settings
      (ucs_id,ucs_uid,ucs_type,ucs_state,ucs_create_time,ucs_update_time)
      values
      (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserCustomSettings"
      useGeneratedKeys="true" keyProperty="id">
      insert into yeshi_ec_user_custom_settings
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">ucs_id,</if>
         <if test="userInfo != null">ucs_uid,</if>
         <if test="type != null">ucs_type,</if>
         <if test="state != null">ucs_state,</if>
         <if test="createTime != null">ucs_create_time,</if>
         <if test="updateTime != null">ucs_update_time,</if>
      </trim>
      values
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">#{id,jdbcType=BIGINT},</if>
         <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if>
         <if test="type != null">#{type,jdbcType=VARCHAR},</if>
         <if test="state != null">#{state,jdbcType=INTEGER},</if>
         <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
         <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
      </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserCustomSettings">update
      yeshi_ec_user_custom_settings set ucs_uid =
      #{userInfo.id,jdbcType=BIGINT},ucs_type =
      #{type,jdbcType=VARCHAR},ucs_state =
      #{state,jdbcType=INTEGER},ucs_create_time =
      #{createTime,jdbcType=TIMESTAMP},ucs_update_time =
      #{updateTime,jdbcType=TIMESTAMP} where ucs_id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserCustomSettings">
      update yeshi_ec_user_custom_settings
      <set>
         <if test="userInfo != null">ucs_uid=#{userInfo.id,jdbcType=BIGINT},</if>
         <if test="type != null">ucs_type=#{type,jdbcType=VARCHAR},</if>
         <if test="state != null">ucs_state=#{state,jdbcType=INTEGER},</if>
         <if test="createTime != null">ucs_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
         <if test="updateTime != null">ucs_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
      </set>
      where ucs_id = #{id,jdbcType=BIGINT}
   </update>
   <select id="getSettingsByUid" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      SELECT * FROM yeshi_ec_user_custom_settings
      WHERE ucs_uid
      = #{uid,jdbcType=BIGINT}
   </select>
   <select id="getSettingsByUidAndType" resultMap="BaseResultMap">
      SELECT * FROM
      yeshi_ec_user_custom_settings
      WHERE ucs_uid = #{uid} AND
      ucs_type=#{type}
   </select>
   <select id="getUserID" resultType="java.lang.Long">
      SELECT ucs_uid FROM
      yeshi_ec_user_custom_settings
      WHERE ucs_state= 1 AND ucs_type=#{type}
   </select>
   <select id="listByUidListAndTypeAndState" resultMap="BaseResultMap">
      SELECT ucs_uid FROM yeshi_ec_user_custom_settings
      WHERE
      ucs_type=#{type}
      <if test="state!=null">
         and ucs_state=#{state}
      </if>
      <if test="uidList!=null">
         <foreach collection="uidList" item="uid" open=" and (" close=")"
            separator=" or ">
            ucs_uid=#{uid}
         </foreach>
      </if>
   </select>
</mapper>