| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?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.finikes.oc.vote.dao.VoteDao">
- <insert id="insert" useGeneratedKeys="true" keyProperty="id" keyColumn="id"
- parameterType="com.finikes.oc.vote.entity.Vote">
- INSERT INTO t_vote (activity_id, sequence, title, content)
- VALUES (#{activityId}, #{sequence}, #{title}, #{content})
- </insert>
- <update id="update" parameterType="com.finikes.oc.vote.entity.Vote">
- UPDATE t_vote
- SET activity_id = #{activityId},
- sequence = #{sequence},
- title = #{title},
- content = #{content}
- WHERE id = #{id}
- </update>
- <update id="updateSelective">
- UPDATE t_vote
- <set>
- <if test="activityId != null">
- activity_id = #{activityId},
- </if>
- <if test="sequence != null">
- sequence = #{sequence},
- </if>
- <if test="title != null">
- title = #{title},
- </if>
- <if test="content != null">
- content = #{content},
- </if>
- </set>
- WHERE id = #{id}
- </update>
- <select id="selectByPrimaryKey" parameterType="integer" resultType="com.finikes.oc.vote.entity.Vote">
- SELECT id, activity_id, sequence, title, content
- FROM t_vote
- WHERE id = #{primaryKey}
- </select>
- <select id="selectByVoteActivityId" resultType="com.finikes.oc.vote.entity.Vote">
- SELECT id, activity_id, sequence, title, content
- FROM t_vote
- WHERE activity_id = #{voteActivityId}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="integer">
- DELETE
- FROM t_vote
- WHERE id = #{primaryKey}
- </delete>
- <select id="getHousesNotVote" resultType="com.finikes.oc.estate.entity.House">
- SELECT id, unitId, name
- FROM t_house h
- WHERE h.id NOT IN (
- SELECT c.house_id
- FROM t_choice c
- WHERE c.option_id IN (SELECT id FROM t_option o WHERE o.vote_id = #{voteId}))
- LIMIT #{offset}
- , #{sectionCapacity}
- </select>
- <select id="getHousesNotVoteNum" resultType="java.lang.Integer">
- SELECT count(1)
- FROM t_house h
- WHERE h.id NOT IN (
- SELECT c.house_id
- FROM t_choice c
- WHERE c.option_id IN (SELECT id FROM t_option o WHERE o.vote_id = #{voteId}))
- </select>
- <select id="getHousesVote" resultType="com.finikes.oc.estate.entity.House">
- SELECT id, unitId, name
- FROM t_house h
- WHERE h.id IN (
- SELECT c.house_id
- FROM t_choice c
- WHERE c.option_id IN (SELECT id FROM t_option o WHERE o.vote_id = #{voteId}))
- LIMIT #{offset}
- , #{sectionCapacity}
- </select>
- <select id="getHousesVoteNum" resultType="java.lang.Integer">
- SELECT count(1)
- FROM t_house h
- WHERE h.id IN (
- SELECT c.house_id
- FROM t_choice c
- WHERE c.option_id IN (SELECT id FROM t_option o WHERE o.vote_id = #{voteId}))
- </select>
- </mapper>
|