| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?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.ChoiceDao">
- <insert id="insert" useGeneratedKeys="true" keyProperty="id" keyColumn="id"
- parameterType="com.finikes.oc.vote.entity.Choice">
- INSERT INTO t_choice (option_id, choose_time, proxy, assignee_id, house_id, signature, sign_code, img_type)
- VALUES (#{optionId}, #{chooseTime}, #{proxy}, #{assigneeId}, #{houseId}, #{signature}, #{signCode}, #{imgType})
- </insert>
- <update id="update" parameterType="com.finikes.oc.vote.entity.Choice">
- UPDATE t_choice
- SET option_id = #{optionId},
- passport_id = #{passportId},
- choose_time = #{chooseTime},
- proxy = #{proxy},
- assignee_id = #{assigneeId}
- WHERE id = #{id}
- </update>
- <select id="selectByPrimaryKey" parameterType="integer" resultType="com.finikes.oc.vote.entity.Choice">
- SELECT id, option_id, passport_id, choose_time, proxy, assignee_id
- FROM t_choice
- WHERE id = #{primaryKey}
- </select>
- <select id="isHouseHolderInThisVote" resultType="java.lang.Boolean">
- SELECT count(1)
- FROM t_option vote_option,
- t_choice choice,
- t_house_relation relation
- WHERE vote_option.vote_id = #{voteId}
- AND choice.passport_id = relation.passportId
- AND certificateNo = #{certificateNo}
- AND state = 1
- </select>
- <select id="isHouseHolderInThisVote_1" resultType="java.lang.Integer">
- select count(1)
- from t_choice c
- where c.house_id = #{houseId}
- and c.option_id in (select id from t_option o where o.vote_id = #{voteId})
- </select>
- <delete id="deleteByPrimaryKey" parameterType="integer">
- DELETE
- FROM t_choice
- WHERE id = #{primaryKey}
- </delete>
- <select id="selectByVoteIds" resultType="com.finikes.oc.vote.dto.OptionSummary">
- SELECT count(1) quantity, option_id, value, vote_id
- FROM t_option,
- t_choice
- WHERE t_option.vote_id IN
- <foreach collection="voteIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND t_choice.option_id = t_option.id
- GROUP BY option_id;
- </select>
- <!--
- <select id="getSuggestionSectionByVote" resultType="com.finikes.oc.vote.dto.OptionSuggestion">
- select c.id as choiceId, p.id as passportId, p.`name` as passportName, c.suggestion as suggestion
- from t_choice c,
- t_passport p
- where c.option_id in (select id from t_option where vote_id = #{voteId})
- and c.passport_id = p.id
- ORDER BY c.choose_time desc LIMIT #{offset}, #{sectionCapacity}
- </select>
- <select id="getSuggestionNumByVote" resultType="java.lang.Integer">
- select count(1)
- from t_choice c
- where c.option_id in
- (select id from t_option where vote_id = #{voteId})
- </select>
- -->
- <select id="findByOption" resultType="com.finikes.oc.vote.dto.ChoiceDetail">
- SELECT h.fullDisplayName as voterName
- FROM t_choice c,
- t_house h
- WHERE c.option_id = #{optionId}
- AND c.house_id = h.id
- </select>
- </mapper>
|