| <?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.aia.op.member.dao.MemberDao"> |
| |
| |
| <resultMap id="memberResult" |
| type="com.aia.op.member.domain.Member"> |
| <id column="idx" property="idx" /> |
| <result column="memberid" property="memberid" /> |
| <result column="membername" property="membername" /> |
| <result column="password" property="password" /> |
| <result column="memberphoto" property="memberphoto" /> |
| <result column="regdate" property="regdate" /> |
| </resultMap> |
| |
| |
| |
| |
| <resultMap id="memberListResult" |
| type="com.aia.op.member.domain.Member"> |
| <id column="idx" property="idx" /> |
| <result column="memberid" property="memberid" /> |
| <result column="membername" property="membername" /> |
| <result column="memberphoto" property="memberphoto" /> |
| <result column="regdate" property="regdate" /> |
| </resultMap> |
| |
| |
| |
| |
| |
| <insert id="insertMember" |
| parameterType="com.aia.op.member.domain.Member"> |
| |
| INSERT INTO member |
| |
| <if test="memberphoto == null"> |
| (memberid, password, membername) |
| VALUES |
| (#{memberid},#{password},#{membername}) |
| </if> |
| |
| <if test="memberphoto != null"> |
| (memberid, password, membername, memberphoto) |
| VALUES |
| (#{memberid},#{password},#{membername},#{memberphoto}) |
| </if> |
| |
| |
| |
| </insert> |
| |
| |
| |
| |
| |
| |
| <select id="selectLogin" resultMap="memberResult"> |
| select * from member where memberid=#{param1} and password=#{param2} |
| </select> |
| |
| |
| |
| <select id="selectTotalCount" resultType="int"> |
| select count(*) from |
| member |
| </select> |
| |
| |
| |
| <select id="selectMemberList" |
| parameterType="map" |
| resultMap="memberListResult"> |
| |
| select * from member |
| <where> |
| <if test="searchParam != null"> |
| <if test="searchParam.searchType == 'id'"> |
| <include refid="searchId"/> |
| </if> |
| <if test="searchParam.searchType == 'name'"> |
| <include refid="searchName"/> |
| </if> |
| <if test="searchParam.searchType == 'both'"> |
| <include refid="searchId"/> |
| <include refid="searchName"/> |
| </if> |
| </if> |
| </where> |
| |
| |
| limit #{index}, #{count} |
| |
| </select> |
| |
| |
| |
| |
| <select id="selectSearchMemberCount" |
| parameterType="com.aia.op.member.domain.SearchParam" |
| resultType="int" |
| > |
| |
| select count(*) from member |
| |
| |
| |
| <where> |
| <if test="searchParam.searchType == 'id'"> |
| |
| <include refid="searchId"/> |
| </if> |
| |
| <if test="searchParam.searchType == 'name'"> |
| |
| <include refid="searchName"/> |
| </if> |
| |
| <if test="searchParam.searchType == 'both'"> |
| |
| |
| |
| <include refid="searchId"/> |
| <include refid="searchName"/> |
| </if> |
| </where> |
| |
| |
| </select> |
| |
| |
| |
| <sql id="searchId"> |
| or memberid like concat('%',#{searchParam.keyword},'%') |
| </sql> |
| |
| <sql id="searchName"> |
| or membername like concat('%',#{searchParam.keyword},'%') |
| </sql> |
| |
| |
| |
| <delete id="deleteMemberByIdx"> |
| delete from member where idx=#{idx} |
| </delete> |
| |
| |
| |
| <select id="selectMemberByIdx" |
| resultMap="memberListResult"> |
| |
| select * from member where idx=#{no} |
| |
| </select> |
| |
| |
| |
| |
| <update id="updateMember" |
| parameterType="com.aia.op.member.domain.Member"> |
| |
| update member |
| set membername=#{membername}, |
| password=#{password}, |
| memberphoto=#{memberphoto} |
| where idx=#{idx} |
| |
| </update> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| </mapper>d |