forest/src/main/java/mapper/PortfolioMapper.xml
2020-04-09 18:50:13 +08:00

30 lines
2.0 KiB
XML

<?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.rymcu.vertical.mapper.PortfolioMapper">
<resultMap id="BaseResultMap" type="com.rymcu.vertical.entity.Portfolio">
<id column="id" property="idPortfolio"></id>
<result column="portfolio_head_img_url" property="headImgUrl"></result>
<result column="portfolio_title" property="portfolioTitle"></result>
<result column="portfolio_author_id" property="portfolioAuthorId"></result>
<result column="portfolio_description" property="portfolioDescription"></result>
<result column="created_time" property="createdTime"></result>
<result column="updated_time" property="updatedTime"></result>
</resultMap>
<resultMap id="DTOResultMap" type="com.rymcu.vertical.dto.PortfolioDTO">
<result column="id" property="idPortfolio"></result>
<result column="portfolio_head_img_url" property="headImgUrl"></result>
<result column="portfolio_title" property="portfolioTitle"></result>
<result column="portfolio_author_id" property="portfolioAuthorId"></result>
<result column="portfolio_description" property="portfolioDescription"></result>
<result column="updated_time" property="updatedTime"></result>
</resultMap>
<select id="selectUserPortfoliosByIdUser" resultMap="DTOResultMap">
select id, portfolio_head_img_url, portfolio_title, portfolio_author_id, portfolio_description, updated_time from vertical_portfolio where portfolio_author_id = #{idUser}
</select>
<select id="selectPortfolioDTOById" resultMap="DTOResultMap">
select id, portfolio_head_img_url, portfolio_title, portfolio_author_id, portfolio_description, updated_time from vertical_portfolio where id = #{id}
</select>
<select id="selectCountArticleNumber" resultType="java.lang.Integer">
select count(*) from vertical_portfolio_article where id_vertical_portfolio = #{idPortfolio}
</select>
</mapper>