Merge branch 'master' of gitee.com:darlk/ShengTangManage into develop
This commit is contained in:
		| @@ -14,18 +14,56 @@ | ||||
|         <result property="updateTime"    column="update_time"    /> | ||||
|         <result property="updateBy"    column="update_by"    /> | ||||
|         <result property="delFlag"    column="del_flag"    /> | ||||
|  | ||||
|         <result property="importFanChannelName" column="import_fan_channel_name"></result> | ||||
|         <result property="liveRoomName" column="live_room_name"></result> | ||||
|         <result property="liveNutritionistName" column="live_nutritionist_name"></result> | ||||
|     </resultMap> | ||||
|  | ||||
|     <resultMap type="SysImportFanRecord" id="SysImportFanRecordResultExtended"> | ||||
|         <result property="id"    column="id"    /> | ||||
|         <result property="importFanDate"    column="import_fan_date"    /> | ||||
|         <result property="importFanChannel"    column="import_fan_channel"    /> | ||||
|         <result property="importFanLive"    column="import_fan_live"    /> | ||||
|         <result property="createTime"    column="create_time"    /> | ||||
|         <result property="createBy"    column="create_by"    /> | ||||
|         <result property="updateTime"    column="update_time"    /> | ||||
|         <result property="updateBy"    column="update_by"    /> | ||||
|         <result property="delFlag"    column="del_flag"    /> | ||||
|  | ||||
|         <result property="importFanChannelName" column="import_fan_channel_name"></result> | ||||
|         <result property="liveRoomName" column="live_room_name"></result> | ||||
|         <result property="liveNutritionistName" column="live_nutritionist_name"></result> | ||||
|  | ||||
|         <!-- 查询该渠道已导粉的微信号 --> | ||||
|         <association property="wxAccountList" column="id" select="getWxAccountListByFanRecordId"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="selectSysImportFanRecordVo"> | ||||
|         select id, import_fan_date, import_fan_channel, import_fan_live, create_time, create_by, update_time, update_by, del_flag from sys_import_fan_record | ||||
|     </sql> | ||||
|  | ||||
|     <select id="selectSysImportFanRecordList" parameterType="SysImportFanRecord" resultMap="SysImportFanRecordResult"> | ||||
|         <include refid="selectSysImportFanRecordVo"/> | ||||
|         where del_flag = 0 | ||||
|         <if test="importFanDate != null "> and import_fan_date = #{importFanDate}</if> | ||||
|         <if test="importFanChannel != null "> and import_fan_channel = #{importFanChannel}</if> | ||||
|         <if test="importFanLive != null "> and import_fan_live = #{importFanLive}</if> | ||||
|     <select id="selectSysImportFanRecordList" parameterType="SysImportFanRecord" resultMap="SysImportFanRecordResultExtended"> | ||||
|         select fc.id, fc.import_fan_date, fc.import_fan_channel, fc.import_fan_live, fc.create_time, | ||||
|         ca.dict_label as import_fan_channel_name, slt.dict_label as live_room_name,su_nutritionist.nick_name as live_nutritionist_name | ||||
|         from sys_import_fan_record as fc | ||||
|         left join (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_account') AS ca ON ca.dict_value = fc.import_fan_channel | ||||
|         left join sys_live_schedul as slc on slc.id = fc.import_fan_live and slc.del_flag = 0 | ||||
|         left join (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'sys_live_type') AS slt ON slt.dict_value = slc.live_room | ||||
|         left join sys_user as su_nutritionist on su_nutritionist.user_id = slc.live_nutritionist_id and su_nutritionist.del_flag = 0 | ||||
|         where fc.del_flag = 0 | ||||
|         <if test="importFanDate != null "> and fc.import_fan_date = #{importFanDate}</if> | ||||
|         <if test="importFanChannel != null "> and fc.import_fan_channel = #{importFanChannel}</if> | ||||
|         order by fc.import_fan_date desc,fc.import_fan_channel asc | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectTotalSysImportFanNum" parameterType="SysImportFanRecord" resultType="int"> | ||||
|         select sum(fwa.import_fan_num) | ||||
|         from sys_import_fan_record as fc | ||||
|         left join sys_import_fan_wx_account fwa on fwa.import_fan_record_id = fc.id and fwa.del_flag = 0 | ||||
|         where fc.del_flag = 0 | ||||
|         <if test="importFanDate != null "> and fc.import_fan_date = #{importFanDate}</if> | ||||
|         <if test="importFanChannel != null "> and fc.import_fan_channel = #{importFanChannel}</if> | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectSysImportFanRecordById" parameterType="Long" resultMap="SysImportFanRecordResult"> | ||||
| @@ -83,4 +121,20 @@ | ||||
|         </foreach> | ||||
|     </update> | ||||
|  | ||||
|     <select id="getFanRecordByChannelLive" parameterType="SysImportFanRecord" resultMap="SysImportFanRecordResult"> | ||||
|         select * from sys_import_fan_record where del_flag = 0 and import_fan_date = #{importFanDate} and import_fan_channel = #{importFanChannel} | ||||
|         and import_fan_live = #{importFanLive} | ||||
|         order by id desc limit 1 | ||||
|     </select> | ||||
|  | ||||
|     <select id="getWxAccountListByFanRecordId" parameterType="Long" resultType="Map"> | ||||
|         select fwc.id, fwc.import_fan_record_id as importFanRecordId, fwc.import_wx_account_id as importWxAccountId, fwc.import_fan_num as importFanNum, | ||||
|         su.nick_name as saleName,wa.wx_account as wxAccount | ||||
|         from sys_import_fan_wx_account fwc | ||||
|         left join sys_wx_sale_account wa on wa.id = fwc.import_wx_account_id and wa.del_flag = 0 | ||||
|         left join sys_wx_distribution swd on swd.wechat_account = wa.id and swd.del_flag = 0 | ||||
|         left join sys_user su on swd.user_id = su.user_id and su.del_flag = 0 | ||||
|         where fwc.del_flag = 0 and fwc.import_fan_record_id = #{id} | ||||
|     </select> | ||||
|  | ||||
| </mapper> | ||||
| @@ -82,4 +82,35 @@ | ||||
|         </foreach> | ||||
|     </update> | ||||
|  | ||||
|     <select id="getWxAccountByFanRecordId" parameterType="SysImportFanWxAccount" resultMap="SysImportFanWxAccountResult"> | ||||
|         select * from sys_import_fan_wx_account where del_flag = 0 and import_fan_record_id = #{importFanRecordId} | ||||
|         and import_wx_account_id = #{importWxAccountId} order by id desc limit 1 | ||||
|     </select> | ||||
|  | ||||
|     <!-- 根据微信号ID查询导粉多少 --> | ||||
|     <select id="getTotalImportFanNum" parameterType="SysImportFanWxAccount" resultType="Map"> | ||||
|         select w.import_wx_account_id as wxAccountId,sum(w.import_fan_num) as fanNum | ||||
|         from | ||||
|         ( | ||||
|           select fwa.import_wx_account_id,fwa.import_fan_num from  sys_import_fan_wx_account fwa | ||||
|           left join sys_import_fan_record ifr on fwa.import_fan_record_id = ifr.id and ifr.del_flag = 0 | ||||
|           where fwa.del_flag = 0 | ||||
|           <if test="importFanDate != null"> | ||||
|             and ifr.import_fan_date = #{importFanDate} | ||||
|           </if> | ||||
|           <if test="importWxAccountId != null"> | ||||
|             and fwa.import_wx_account_id = #{importWxAccountId} | ||||
|           </if> | ||||
|         ) w | ||||
|         group by w.import_wx_account_id order by w.import_wx_account_id desc | ||||
|     </select> | ||||
|  | ||||
|     <!-- 根据导粉ID删除对应所有微信记录 --> | ||||
|     <update id="deleteSysImportFanWxAccountByFanRecordIds" parameterType="String"> | ||||
|         update sys_import_fan_wx_account set del_flag = 1 where import_fan_record_id in | ||||
|         <foreach item="id" collection="array" open="(" separator="," close=")"> | ||||
|             #{id} | ||||
|         </foreach> | ||||
|     </update> | ||||
|  | ||||
| </mapper> | ||||
| @@ -28,7 +28,7 @@ | ||||
|         <result property="fanChannelName"  column="fan_channel_name"></result> | ||||
|  | ||||
|         <!-- 根据渠道查询对应微信号(微信账号分配表中) --> | ||||
|         <!--<association property="wxAccountList" column="fan_channel" select="getWxAccountListByFanChannel"/>--> | ||||
|         <association property="wxAccountList" column="id" select="getWxAccountListByLiveId"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <resultMap type="SysLiveSchedul" id="SysLiveSchedulResultSigle"> | ||||
| @@ -74,9 +74,9 @@ | ||||
|         <if test="fanChannel != null"> | ||||
|             and slc.fan_channel = #{fanChannel} | ||||
|         </if> | ||||
|         <if test="wxAccountId != null"> | ||||
|         <!--<if test="wxAccountId != null"> | ||||
|             and slc.fan_channel = (SELECT swd.account_id FROM sys_wx_distribution AS swd where swd.wechat_account = #{wxAccountId} and swd.del_flag = 0 limit 1) | ||||
|         </if> | ||||
|         </if>--> | ||||
|         order by slc.live_schedul_date desc,slc.live_start_time desc ,slc.live_room asc | ||||
|     </select> | ||||
|  | ||||
| @@ -162,14 +162,15 @@ | ||||
|         </foreach> | ||||
|     </update> | ||||
|  | ||||
|     <!-- 根据渠道查询该渠道下分配的微信号 --> | ||||
|     <select id="getWxAccountListByFanChannel" parameterType="Integer" resultType="Map"> | ||||
|       SELECT su.nick_name as nickName,swsa.wx_account as wxAccount,asg.dict_label as saleGroupName | ||||
|       FROM sys_wx_distribution AS swd | ||||
|       lEFT JOIN sys_wx_sale_account swsa ON swsa.id = swd.wechat_account and swsa.del_flag = 0 | ||||
|       LEFT JOIN sys_user su ON su.user_id = swd.user_id AND su.del_flag = 0 | ||||
|       LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'sale_group') AS asg ON asg.dict_value = swd.sale_group_id | ||||
|       where swd.account_id = #{fan_channel} and swd.del_flag = 0 | ||||
|     <!-- 根据直播ID查询该渠道下分配的微信号 --> | ||||
|     <select id="getWxAccountListByLiveId" parameterType="Long" resultType="Map"> | ||||
|       SELECT su.nick_name as saleName,w.wx_account as wxAccount, sum(wa.import_fan_num) as fanNum from sys_import_fan_record as fc | ||||
|       left join sys_import_fan_wx_account as wa on wa.import_fan_record_id =  fc.id and wa.del_flag = 0 | ||||
|       left join sys_wx_sale_account as w on w.id = wa.import_wx_account_id and w.del_flag = 0 | ||||
|       left join sys_wx_distribution swd on swd.wechat_account = w.id and swd.del_flag = 0 | ||||
|       left join sys_user su on swd.user_id = su.user_id and su.del_flag = 0 | ||||
|       where fc.import_fan_live = #{id} and fc.del_flag = 0 | ||||
|       group by w.wx_account,su.nick_name | ||||
|     </select> | ||||
|  | ||||
|     <!-- 查询直播时间范围是否重叠 --> | ||||
|   | ||||
| @@ -198,12 +198,16 @@ | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectDishesByMenuIdShow" parameterType="Long" resultMap="SysDishesResultShow"> | ||||
|         SELECT * FROM (SELECT id, menu_id, dishes_id, type, detail, remark FROM sys_customer_menu_dishes WHERE menu_id = #{id}) AS menu | ||||
|         LEFT JOIN sys_dishes ON menu.dishes_id = sys_dishes.id | ||||
|         SELECT | ||||
|         menu.id, menu.menu_id, menu.dishes_id, menu.type, menu.detail, menu.remark, sd.is_main,sd.name,sd.methods | ||||
|         FROM (SELECT id, menu_id, dishes_id, type, detail, remark FROM sys_customer_menu_dishes WHERE menu_id = #{id}) AS menu | ||||
|         LEFT JOIN sys_dishes as sd ON menu.dishes_id = sd.id | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectIngredientsByDishesIdShow" parameterType="Long" resultMap="SysIgdsResultShow"> | ||||
|        SELECT * FROM( | ||||
|        SELECT | ||||
|        ing.id,ing.name,ing.type.ing.protein_ratio,ing.fat_ratio,ing.carbon_ratio.ing.area,dishes.cus_weight,dishes.cus_unit,dishes.weight | ||||
|        FROM( | ||||
|             SELECT ingredient_id AS id, ingredient_weight AS weight, cus_weight, cus_unit, remark | ||||
|             FROM sys_dishes_ingredient | ||||
|             WHERE dishes_id = #{id} | ||||
|   | ||||
| @@ -19,6 +19,9 @@ | ||||
|         <result property="delFlag" column="del_flag"/> | ||||
|         <result property="status" column="status"/> | ||||
|         <result property="useCount" column="use_count"/> | ||||
|  | ||||
|         <!-- 销售 --> | ||||
|         <result property="saleName" column="sale_name"></result> | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="selectSysWxSaleAccountVo"> | ||||
| @@ -31,6 +34,7 @@ | ||||
|         <if test="wxNickName != null  and wxNickName != ''">and wx_nick_name like concat('%', #{wxNickName}, '%')</if> | ||||
|         <if test="wxAccount != null  and wxAccount != ''">and wx_account like concat('%', #{wxAccount}, '%')</if> | ||||
|         <if test="wxPhone != null  and wxPhone != ''">and wx_phone like concat('%', #{wxPhone}, '%')</if> | ||||
|         <if test="status != null">and status = #{status}</if> | ||||
|         order by id desc | ||||
|     </select> | ||||
|  | ||||
| @@ -134,4 +138,14 @@ | ||||
|         </trim> | ||||
|     </insert> | ||||
|  | ||||
|     <!-- 查询可以接粉的微信号以及对应销售,用于导粉记录管理 --> | ||||
|     <select id="getWxAccountAndSale" resultMap="SysWxSaleAccountResult"> | ||||
|         select wa.id, wa.wx_account, su.nick_name as sale_name | ||||
|         from sys_wx_sale_account wa | ||||
|         left join sys_wx_distribution swd on wa.id = swd.wechat_account and swd.del_flag = 0 | ||||
|         LEFT JOIN sys_user su ON su.user_id = swd.user_id AND su.del_flag = 0 | ||||
|         where wa.del_flag = 0 and wa.status = 0 | ||||
|         order by su.user_id asc | ||||
|     </select> | ||||
|  | ||||
| </mapper> | ||||
| @@ -129,4 +129,10 @@ | ||||
|         </foreach> | ||||
|     </delete> | ||||
|  | ||||
|     <!-- 根据手机号查询微信用户 --> | ||||
|     <select id="getSysWxUserInfoByPhone" parameterType="String" resultMap="SysWxUserInfoResult"> | ||||
|         <include refid="selectSysWxUserInfoVo"/> | ||||
|         where phone = #{phone} order by create_time desc limit 1 | ||||
|     </select> | ||||
|  | ||||
| </mapper> | ||||
		Reference in New Issue
	
	Block a user