| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- <?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.goafanti.common.dao.RestrictProjectMapper">
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.RestrictProject">
- <id property="id" column="id" jdbcType="INTEGER"/>
- <result property="pid" column="pid" jdbcType="VARCHAR"/>
- <result property="uid" column="uid" jdbcType="VARCHAR"/>
- <result property="aid" column="aid" jdbcType="VARCHAR"/>
- <result property="type" column="type" jdbcType="INTEGER"/>
- <result property="lockTime" column="lock_time" jdbcType="TIMESTAMP"/>
- <result property="releaseTime" column="release_time" jdbcType="TIMESTAMP"/>
- <result property="lastFollowTime" column="last_follow_time" jdbcType="TIMESTAMP"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- </resultMap>
- <sql id="Base_Column_List">
- id,pid,uid,
- aid,type,lock_time,
- release_time,last_follow_time,create_time
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from restrict_project
- where id = #{id,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
- delete from restrict_project
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <delete id="deleteByPram">
- delete from restrict_project
- where uid = #{uid}
- and pid = #{pid}
- </delete>
- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.RestrictProject" useGeneratedKeys="true">
- insert into restrict_project
- ( id,pid,uid
- ,aid,type,lock_time
- ,release_time,last_follow_time,create_time
- )
- values (#{id,jdbcType=INTEGER},#{pid,jdbcType=VARCHAR},#{uid,jdbcType=VARCHAR}
- ,#{aid,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{lockTime,jdbcType=TIMESTAMP}
- ,#{releaseTime,jdbcType=TIMESTAMP},#{lastFollowTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP}
- )
- </insert>
- <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.RestrictProject" useGeneratedKeys="true">
- insert into restrict_project
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="pid != null">pid,</if>
- <if test="uid != null">uid,</if>
- <if test="aid != null">aid,</if>
- <if test="type != null">type,</if>
- <if test="lockTime != null">lock_time,</if>
- <if test="releaseTime != null">release_time,</if>
- <if test="lastFollowTime != null">last_follow_time,</if>
- <if test="createTime != null">create_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id,jdbcType=INTEGER},</if>
- <if test="pid != null">#{pid,jdbcType=VARCHAR},</if>
- <if test="uid != null">#{uid,jdbcType=VARCHAR},</if>
- <if test="aid != null">#{aid,jdbcType=VARCHAR},</if>
- <if test="type != null">#{type,jdbcType=INTEGER},</if>
- <if test="lockTime != null">#{lockTime,jdbcType=TIMESTAMP},</if>
- <if test="releaseTime != null">#{releaseTime,jdbcType=TIMESTAMP},</if>
- <if test="lastFollowTime != null">#{lastFollowTime,jdbcType=TIMESTAMP},</if>
- <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.RestrictProject">
- update restrict_project
- <set>
- <if test="pid != null">
- pid = #{pid,jdbcType=VARCHAR},
- </if>
- <if test="uid != null">
- uid = #{uid,jdbcType=VARCHAR},
- </if>
- <if test="aid != null">
- aid = #{aid,jdbcType=VARCHAR},
- </if>
- <if test="type != null">
- type = #{type,jdbcType=INTEGER},
- </if>
- <if test="lockTime != null">
- lock_time = #{lockTime,jdbcType=TIMESTAMP},
- </if>
- <if test="releaseTime != null">
- release_time = #{releaseTime,jdbcType=TIMESTAMP},
- </if>
- <if test="lastFollowTime != null">
- last_follow_time = #{lastFollowTime,jdbcType=TIMESTAMP},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.RestrictProject">
- update restrict_project
- set
- pid = #{pid,jdbcType=VARCHAR},
- uid = #{uid,jdbcType=VARCHAR},
- aid = #{aid,jdbcType=VARCHAR},
- type = #{type,jdbcType=INTEGER},
- lock_time = #{lockTime,jdbcType=TIMESTAMP},
- release_time = #{releaseTime,jdbcType=TIMESTAMP},
- last_follow_time = #{lastFollowTime,jdbcType=TIMESTAMP},
- create_time = #{createTime,jdbcType=TIMESTAMP}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <select id="selectByUidAndAid" resultType="com.goafanti.business.bo.OutRestrictProject">
- select a.id pid ,b.id,a.bname projectName,b.type,b.lock_time lockTime,b.release_time releaseTime ,
- c.nickname userName ,d.name adminName,b.create_time createTime,b.uid,b.aid
- from business_project a
- left join restrict_project b on a.id =b.pid and b.uid =#{uid,jdbcType=VARCHAR}
- left join user c on b.uid=c.id left join admin d on b.aid=d.id
- where a.restrict_status =1
- </select>
- <select id="RestrictProjectList" resultType="com.goafanti.business.bo.RestrictProjectPageList">
- select *
- from (select a.id,b.nickname name,c.bname projectName,a.`type` ,ad.name userAdmin,ad2.name adminName,a.lock_time lockTime,
- a.last_follow_time lastFollowTime,a.uid, b.society_tag societyTag,dg1.name as province, dg2.name as city,
- dg3.name as area,d.intended_project intendedProject, d.business_scope businessScope,a.pid,
- (if(a.type=1,30,270) -DATEDIFF(now(),if(a.last_follow_time>a.lock_time,a.last_follow_time,a.lock_time)))days
- from restrict_project a
- left join user b on a.uid =b.id left join business_project c on a.pid =c.id
- left join admin ad on b.aid =ad.id left join admin ad2 on a.aid =ad2.id
- left join organization_identity d on b.id = d.uid
- left join district_glossory dg1 on d.location_province = dg1.id
- left join district_glossory dg2 on d.location_city = dg2.id
- left join district_glossory dg3 on d.location_area = dg3.id
- where a.`type` >0
- <include refid="RestrictProjectSql"/>
- )x
- order by x.days
- <if test="page_sql != null">
- ${page_sql}
- </if>
- </select>
- <sql id="RestrictProjectSql">
- <if test="aid != null">
- and a.aid =#{aid}
- </if>
- <if test="userName !=null">
- and b.nickname like concat('%',#{userName},'%')
- </if>
- <if test="projectName !=null">
- and c.bname =#{projectName}
- </if>
- <if test="type !=null">
- and a.`type` =#{type}
- </if>
- <if test="startTime !=null and endTime !=null">
- and a.last_follow_time between #{startTime} and #{endTime}
- </if>
- </sql>
- <select id="RestrictProjectCount" resultType="java.lang.Integer">
- select count(*)
- from restrict_project a
- left join user b on a.uid =b.id left join business_project c on a.pid =c.id
- left join admin d on b.aid =d.id left join admin d2 on a.aid =d2.id
- where a.`type` >0
- <include refid="RestrictProjectSql"/>
- </select>
- <select id="selectByUid" resultType="com.goafanti.business.bo.OutRestrictProject">
- select b.id,b.type,b.lock_time lockTime,b.release_time releaseTime ,b.pid,a.bname projectName,
- c.nickname userName ,d.name adminName,b.create_time createTime,b.uid,b.aid
- from restrict_project b left join business_project a on b.pid =a.id
- left join user c on b.uid=c.id left join admin d on b.aid=d.id
- where b.aid= #{aid,jdbcType=VARCHAR}
- </select>
- <select id="selectByParam" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from restrict_project
- where uid =#{uid,jdbcType=VARCHAR}
- <if test="aid != null">
- and aid = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="pid != null">
- and pid = #{pid,jdbcType=VARCHAR}
- </if>
- </select>
- <select id="selectListByParam" resultType="com.goafanti.common.model.RestrictProject">
- select
- <include refid="Base_Column_List" />
- from restrict_project
- where type >0
- where uid =#{uid,jdbcType=VARCHAR}
- <if test="aid != null">
- and aid = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="pid != null">
- and pid = #{pid,jdbcType=VARCHAR}
- </if>
- </select>
- <update id="updateRelease">
- update restrict_project set release_time = now(),type=0
- where id in
- <foreach collection="list" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </update>
- <update id="updateRefreshLockTime">
- update restrict_project set lock_time = now(),last_follow_time = now()
- where uid = #{uid,jdbcType=VARCHAR} and pid = #{pid,jdbcType=VARCHAR} and aid = #{aid,jdbcType=VARCHAR}
- </update>
- </mapper>
|