| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <?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.ylx.massage.mapper.MaProjectMapper">
- <resultMap type="MaProject" id="MaProjectResult">
- <result property="id" column="id" />
- <result property="projectName" column="project_name" />
- <result property="projectDescribe" column="project_describe" />
- <result property="projectDuration" column="project_duration" />
- <result property="projectUsersNum" column="project_users_num" />
- <result property="projectOriginalPrice" column="project_original_price" />
- <result property="projectCurrentPrice" column="project_current_price" />
- <result property="projectMasterImage" column="project_master_image" />
- <result property="projectDetailImage" column="project_detail_image" />
- <result property="projectIsEnable" column="project_is_enable" />
- <result property="createUser" column="create_user" />
- <result property="updateUser" column="update_user" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="isDelete" column="is_delete" />
- </resultMap>
- <sql id="selectMaProjectVo">
- select id, project_name, project_describe, project_duration, project_users_num, project_original_price, project_current_price, project_master_image, project_detail_image, project_is_enable, create_user, update_user, create_time, update_time, is_delete from ma_project
- </sql>
- <select id="selectMaProjectList" parameterType="MaProject" resultMap="MaProjectResult">
- <include refid="selectMaProjectVo"/>
- <where>
- is_delete !=1
- <if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
- <if test="projectDescribe != null and projectDescribe != ''"> and project_describe = #{projectDescribe}</if>
- <if test="projectDuration != null "> and project_duration = #{projectDuration}</if>
- <if test="projectUsersNum != null "> and project_users_num = #{projectUsersNum}</if>
- <if test="projectOriginalPrice != null "> and project_original_price = #{projectOriginalPrice}</if>
- <if test="projectCurrentPrice != null "> and project_current_price = #{projectCurrentPrice}</if>
- <if test="projectMasterImage != null and projectMasterImage != ''"> and project_master_image = #{projectMasterImage}</if>
- <if test="projectDetailImage != null and projectDetailImage != ''"> and project_detail_image = #{projectDetailImage}</if>
- <if test="projectIsEnable != null "> and project_is_enable = #{projectIsEnable}</if>
- <if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if>
- <if test="updateUser != null and updateUser != ''"> and update_user = #{updateUser}</if>
- </where>
- </select>
- <select id="selectMaProjectById" parameterType="Long" resultMap="MaProjectResult">
- <include refid="selectMaProjectVo"/>
- where is_delete !=1 and id = #{id}
- </select>
- <insert id="insertMaProject" parameterType="MaProject" useGeneratedKeys="true" keyProperty="id">
- insert into ma_project
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="projectName != null and projectName != ''">project_name,</if>
- <if test="projectDescribe != null and projectDescribe != ''">project_describe,</if>
- <if test="projectDuration != null">project_duration,</if>
- <if test="projectUsersNum != null">project_users_num,</if>
- <if test="projectOriginalPrice != null">project_original_price,</if>
- <if test="projectCurrentPrice != null">project_current_price,</if>
- <if test="projectMasterImage != null and projectMasterImage != ''">project_master_image,</if>
- <if test="projectDetailImage != null and projectDetailImage != ''">project_detail_image,</if>
- <if test="projectIsEnable != null">project_is_enable,</if>
- <if test="createUser != null and createUser != ''">create_user,</if>
- <if test="updateUser != null and updateUser != ''">update_user,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="isDelete != null">is_delete,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="projectName != null and projectName != ''">#{projectName},</if>
- <if test="projectDescribe != null and projectDescribe != ''">#{projectDescribe},</if>
- <if test="projectDuration != null">#{projectDuration},</if>
- <if test="projectUsersNum != null">#{projectUsersNum},</if>
- <if test="projectOriginalPrice != null">#{projectOriginalPrice},</if>
- <if test="projectCurrentPrice != null">#{projectCurrentPrice},</if>
- <if test="projectMasterImage != null and projectMasterImage != ''">#{projectMasterImage},</if>
- <if test="projectDetailImage != null and projectDetailImage != ''">#{projectDetailImage},</if>
- <if test="projectIsEnable != null">#{projectIsEnable},</if>
- <if test="createUser != null and createUser != ''">#{createUser},</if>
- <if test="updateUser != null and updateUser != ''">#{updateUser},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="isDelete != null">#{isDelete},</if>
- </trim>
- </insert>
- <update id="updateMaProject" parameterType="MaProject">
- update ma_project
- <trim prefix="SET" suffixOverrides=",">
- <if test="projectName != null and projectName != ''">project_name = #{projectName},</if>
- <if test="projectDescribe != null and projectDescribe != ''">project_describe = #{projectDescribe},</if>
- <if test="projectDuration != null">project_duration = #{projectDuration},</if>
- <if test="projectUsersNum != null">project_users_num = #{projectUsersNum},</if>
- <if test="projectOriginalPrice != null">project_original_price = #{projectOriginalPrice},</if>
- <if test="projectCurrentPrice != null">project_current_price = #{projectCurrentPrice},</if>
- <if test="projectMasterImage != null and projectMasterImage != ''">project_master_image = #{projectMasterImage},</if>
- <if test="projectDetailImage != null and projectDetailImage != ''">project_detail_image = #{projectDetailImage},</if>
- <if test="projectIsEnable != null">project_is_enable = #{projectIsEnable},</if>
- <if test="createUser != null and createUser != ''">create_user = #{createUser},</if>
- <if test="updateUser != null and updateUser != ''">update_user = #{updateUser},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="isDelete != null">is_delete = #{isDelete},</if>
- </trim>
- where id = #{id}
- </update>
- <update id="deleteMaProjectById" parameterType="Long">
- update ma_project set is_delete = 1 where id = #{id}
- </update>
- <delete id="deleteMaProjectByIds" parameterType="String">
- delete from ma_project where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <!-- 推荐项目-->
- <select id="getMassageProjectRecommend" resultType="com.ylx.massage.domain.vo.MassageProjectRecommendVo">
- SELECT
- p.project_name AS projectName,
- p.project_duration AS projectDuration,
- t.avg_current_price AS avgCurrentPrice,
- j.highlight AS highlight,
- o.sales AS sales
- FROM (
- SELECT MIN(id) AS id
- FROM ma_project
- WHERE is_delete = 0 AND audit_status = 1
- GROUP BY project_id
- ) AS keep
- INNER JOIN ma_project p ON keep.id = p.id
- LEFT JOIN project j ON p.project_id = j.id
- LEFT JOIN (
- SELECT
- t.project_id,
- AVG(t.project_current_price) AS avg_current_price
- FROM ma_project t
- WHERE t.is_delete = 0
- GROUP BY t.project_id
- ) t ON p.project_id = t.project_id
- LEFT JOIN
- (
- SELECT
- o.project_id AS project_id,
- COUNT(*) AS sales
- FROM
- t_order o
- WHERE o.is_delete = 0
- AND o.n_status = 7
- AND o.project_type = 1
- GROUP BY o.project_id
- ) o
- ON p.project_id = o.project_id
- WHERE p.is_delete = 0
- and p.audit_status = 1
- </select>
- </mapper>
|