Commit 96a2210b by 吴博

feat-wb-1002904

parent f2eac8cf
...@@ -54,4 +54,8 @@ public interface CustomPlanBiz { ...@@ -54,4 +54,8 @@ public interface CustomPlanBiz {
List<CustomPlan> listByCustomPlanIds(List<Long> customPlanIds); List<CustomPlan> listByCustomPlanIds(List<Long> customPlanIds);
Map<Long, CustomPlan> getByIds(List<Long> planIds); Map<Long, CustomPlan> getByIds(List<Long> planIds);
void editCustomRightsSetting(EditCustomRightsSettingVO editCustomRightsSettingVO);
EditCustomRightsSettingVO getCustomRightsSettingModule(Integer planId);
} }
package com.pcloud.book.custom.entity;
import java.util.Date;
import java.util.List;
import lombok.Data;
@Data
public class CustomPlanRightsSetting {
private Long id;
private Long customPlanId;
private Integer moduleType;
private String moduleTitle;
private String buttonName;
private String defaultUrl;
private Integer readType;
private String bookName;
private Date createTime;
private Date updateTime;
private List<CustomRightsSettingItem> customRightsSettingItems;
}
\ No newline at end of file
package com.pcloud.book.custom.entity;
import java.util.Date;
import lombok.Data;
@Data
public class CustomRightsItemDescription {
private Long id;
private Long customRightsSettingItemId;
private String descripiton;
private Date createTime;
private Date updateTime;
}
\ No newline at end of file
package com.pcloud.book.custom.entity;
import java.util.Date;
import java.util.List;
import lombok.Data;
@Data
public class CustomRightsSettingItem {
private Long id;
private Long customRightsSettingId;
private Long rightsSettingClassifyId;
private String picUrl;
private String itemTitle;
private List<CustomRightsItemDescription> customRightsItemDescriptions;
private Date createTime;
private Date updateTime;
}
\ No newline at end of file
package com.pcloud.book.custom.enums;
public enum PlanRightsEnum {
/**
* 立享
*/
RIGHT_NOW(1),
/**
* 周
*/
WEEK(2),
/**
* 长期
*/
LONG(3),
/**
* 头部
*/
TOP(4),
/**
* 底部
*/
BOTTOM(5);
public final Integer value;
PlanRightsEnum(Integer value) {
this.value = value;
}
}
...@@ -10,6 +10,7 @@ import com.pcloud.book.custom.vo.AddBookNameVO; ...@@ -10,6 +10,7 @@ import com.pcloud.book.custom.vo.AddBookNameVO;
import com.pcloud.book.custom.vo.AddCustomPlan4UserVO; import com.pcloud.book.custom.vo.AddCustomPlan4UserVO;
import com.pcloud.book.custom.vo.AddSuggestionVO; import com.pcloud.book.custom.vo.AddSuggestionVO;
import com.pcloud.book.custom.vo.EditCustomPlanModuleVO; import com.pcloud.book.custom.vo.EditCustomPlanModuleVO;
import com.pcloud.book.custom.vo.EditCustomRightsSettingVO;
import com.pcloud.book.custom.vo.ModuleSuggestionVO; import com.pcloud.book.custom.vo.ModuleSuggestionVO;
import com.pcloud.book.custom.vo.SuggestionListVO; import com.pcloud.book.custom.vo.SuggestionListVO;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
...@@ -17,9 +18,11 @@ import com.pcloud.common.exceptions.BizException; ...@@ -17,9 +18,11 @@ import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException; import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil; import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -275,4 +278,30 @@ public class CustomPlanFacade { ...@@ -275,4 +278,30 @@ public class CustomPlanFacade {
} }
@ApiOperation("编辑定制服务权益")
@PostMapping("editCustomRightsSetting")
ResponseDto<?> editCustomRightsSetting(
@RequestHeader("token") String token,
@RequestBody EditCustomRightsSettingVO editCustomRightsSettingVO
)throws BizException, PermissionException{
customPlanBiz.editCustomRightsSetting(editCustomRightsSettingVO);
return new ResponseDto<>();
}
@ApiOperation("获取定制服务权益")
@GetMapping("getCustomRightsSettingModule")
ResponseDto<EditCustomRightsSettingVO> getCustomRightsSettingModule(
@RequestHeader String token, @RequestParam Integer planId
)throws BizException, PermissionException{
return new ResponseDto<EditCustomRightsSettingVO>(customPlanBiz.getCustomRightsSettingModule(planId));
}
@ApiOperation("客户端获取定制服务权益")
@GetMapping("getCustomRightsSettingModule4Wechat")
ResponseDto<EditCustomRightsSettingVO> getCustomRightsSettingModule4Wechat(
@CookieValue("userInfo") String userInfo, @RequestParam Integer planId
)throws BizException, PermissionException{
return new ResponseDto<EditCustomRightsSettingVO>(customPlanBiz.getCustomRightsSettingModule(planId));
}
} }
package com.pcloud.book.custom.mapper;
import com.pcloud.book.custom.entity.CustomPlanRightsSetting;
import com.pcloud.book.custom.vo.EditCustomRightsSettingVO;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomPlanRightsSettingMapper {
int deleteByPrimaryKey(Long id);
int insert(CustomPlanRightsSetting record);
int insertSelective(CustomPlanRightsSetting record);
CustomPlanRightsSetting selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(CustomPlanRightsSetting record);
int updateByPrimaryKey(CustomPlanRightsSetting record);
void deleteByPlanId(Integer planId);
EditCustomRightsSettingVO getCustomRightsSettingModule(Integer planId);
}
\ No newline at end of file
package com.pcloud.book.custom.mapper;
import com.pcloud.book.custom.entity.CustomRightsItemDescription;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomRightsItemDescriptionMapper {
int deleteByPrimaryKey(Long id);
int insert(CustomRightsItemDescription record);
int insertSelective(CustomRightsItemDescription record);
CustomRightsItemDescription selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(CustomRightsItemDescription record);
int updateByPrimaryKey(CustomRightsItemDescription record);
void batchInsert(List<CustomRightsItemDescription> customRightsItemDescriptionList);
void deleteByPlanId(Integer planId);
}
\ No newline at end of file
package com.pcloud.book.custom.mapper;
import com.pcloud.book.custom.entity.CustomPlan;
import com.pcloud.book.custom.entity.CustomRightsSettingItem;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomRightsSettingItemMapper {
int deleteByPrimaryKey(Long id);
int insert(CustomRightsSettingItem record);
int insertSelective(CustomRightsSettingItem record);
CustomRightsSettingItem selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(CustomRightsSettingItem record);
int updateByPrimaryKey(CustomRightsSettingItem record);
void deleteByPlanId(Integer planId);
}
\ No newline at end of file
package com.pcloud.book.custom.vo;
import com.pcloud.book.custom.entity.CustomPlanRightsSetting;
import java.util.List;
import lombok.Data;
/**
* @ClassName com.pcloud.book.custom.vo.CustomRightsSettingVO
* @Author 吴博
* @Description 定制服务权益
* @Date 2020/5/19 15:11
* @Version 1.0
**/
@Data
public class EditCustomRightsSettingVO {
private Integer planId;
private List<CustomPlanRightsSetting> customPlanRightsSettings;
}
\ No newline at end of file
...@@ -5,6 +5,8 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingClassify; ...@@ -5,6 +5,8 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingItem; import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.ArrayList;
import java.util.Map;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -45,4 +47,6 @@ public interface RightsSettingItemDao extends BaseDao<RightsSettingItem>{ ...@@ -45,4 +47,6 @@ public interface RightsSettingItemDao extends BaseDao<RightsSettingItem>{
List<RightsSettingItem> getItemsByRightsSettingId4Read(Long rightsSettingId, String rightsType); List<RightsSettingItem> getItemsByRightsSettingId4Read(Long rightsSettingId, String rightsType);
ReadTypeCountDTO getCount4Item(Long rightsSettingId); ReadTypeCountDTO getCount4Item(Long rightsSettingId);
Map<Long, RightsSettingClassify> getRightsClassifyMap(ArrayList<Long> longs);
} }
\ No newline at end of file
...@@ -6,6 +6,8 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingClassify; ...@@ -6,6 +6,8 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingItem; import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import com.pcloud.common.utils.ListUtils;
import java.util.ArrayList;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap; import java.util.HashMap;
...@@ -60,4 +62,12 @@ public class RightsSettingItemDaoImpl extends BaseDaoImpl<RightsSettingItem> imp ...@@ -60,4 +62,12 @@ public class RightsSettingItemDaoImpl extends BaseDaoImpl<RightsSettingItem> imp
public ReadTypeCountDTO getCount4Item(Long rightsSettingId) { public ReadTypeCountDTO getCount4Item(Long rightsSettingId) {
return getSessionTemplate().selectOne(getStatement("getCount4Item"),rightsSettingId); return getSessionTemplate().selectOne(getStatement("getCount4Item"),rightsSettingId);
} }
@Override
public Map<Long, RightsSettingClassify> getRightsClassifyMap(ArrayList<Long> ids) {
if (ListUtils.isEmpty(ids)){
return new HashMap<>();
}
return getSessionTemplate().selectMap(getStatement("getRightsClassifyMap"),ids,"id");
}
} }
...@@ -26,7 +26,6 @@ public class RightsSettingClassify extends BaseEntity { ...@@ -26,7 +26,6 @@ public class RightsSettingClassify extends BaseEntity {
*/ */
private String rightsType; private String rightsType;
private String picUrl;
} }
\ No newline at end of file
...@@ -5,8 +5,8 @@ server: ...@@ -5,8 +5,8 @@ server:
eureka: eureka:
instance: instance:
status-page-url-path: /book/v1.0/swagger-ui.html status-page-url-path: /book/v1.0/swagger-ui.html
#client: client:
#register-with-eureka: false #禁止自己当做服务注册 register-with-eureka: false #禁止自己当做服务注册
spring: spring:
application: application:
......
...@@ -16,18 +16,18 @@ ...@@ -16,18 +16,18 @@
connectionURL="jdbc:mysql://192.168.92.41:3306/book" userId="root" connectionURL="jdbc:mysql://192.168.92.41:3306/book" userId="root"
password="LGSC2016.lgsc"/> password="LGSC2016.lgsc"/>
<javaModelGenerator targetPackage="com.pcloud.book.rightsSetting.entity" <javaModelGenerator targetPackage="com.pcloud.book.custom.entity"
targetProject="src\main\java"> targetProject="src\main\java">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/> <property name="trimStrings" value="true"/>
</javaModelGenerator> </javaModelGenerator>
<sqlMapGenerator targetPackage="mapper.rightssetting" <sqlMapGenerator targetPackage="mapper.custom"
targetProject="src\main\resources"> targetProject="src\main\resources">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
</sqlMapGenerator> </sqlMapGenerator>
<javaClientGenerator targetPackage="com.pcloud.book.rightsSetting.dao" <javaClientGenerator targetPackage="com.pcloud.book.custom.mapper"
targetProject="src\main\java" type="XMLMAPPER"> targetProject="src\main\java" type="XMLMAPPER">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
</javaClientGenerator> </javaClientGenerator>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
selectByExampleQueryId="false"> selectByExampleQueryId="false">
</table>--> </table>-->
<table tableName="rights_read_type" domainObjectName="RightsReadType" <table tableName="custom_rights_item_description" domainObjectName="CustomRightsItemDescription"
enableCountByExample="false" enableUpdateByExample="false" enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"> selectByExampleQueryId="false">
......
<?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.pcloud.book.custom.mapper.CustomPlanRightsSettingMapper" >
<resultMap id="BaseResultMap" type="com.pcloud.book.custom.entity.CustomPlanRightsSetting" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="custom_plan_id" property="customPlanId" jdbcType="BIGINT" />
<result column="module_type" property="moduleType" jdbcType="INTEGER" />
<result column="module_title" property="moduleTitle" jdbcType="VARCHAR" />
<result column="button_name" property="buttonName" jdbcType="VARCHAR" />
<result column="default_url" property="defaultUrl" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<resultMap id="VOMap" type="com.pcloud.book.custom.vo.EditCustomRightsSettingVO">
<id column="custom_plan_id" property="planId"/>
<collection property="customPlanRightsSettings" ofType="com.pcloud.book.custom.entity.CustomPlanRightsSetting"
resultMap="RightsSettingMap"/>
</resultMap>
<resultMap id="RightsSettingMap" type="com.pcloud.book.custom.entity.CustomPlanRightsSetting">
<id column="csid" property="id"/>
<result column="custom_plan_id" property="customPlanId"/>
<result column="module_type" property="moduleType"/>
<result column="module_title" property="moduleTitle"/>
<result column="button_name" property="buttonName"/>
<result column="default_url" property="defaultUrl"/>
<collection property="customRightsSettingItems" ofType="com.pcloud.book.custom.entity.CustomRightsSettingItem" resultMap="ItemMap"/>
</resultMap>
<resultMap id="ItemMap" type="com.pcloud.book.custom.entity.CustomRightsSettingItem">
<id column="crid" property="id"/>
<result column="custom_rights_setting_id" property="customRightsSettingId"/>
<result column="rights_setting_classify_id" property="rightsSettingClassifyId"/>
<result column="item_title" property="itemTitle"/>
<collection property="customRightsItemDescriptions" ofType="com.pcloud.book.custom.entity.CustomRightsItemDescription"
resultMap="descriptionMap"/>
</resultMap>
<resultMap id="descriptionMap" type="com.pcloud.book.custom.entity.CustomRightsItemDescription">
<id column="cdid" property="id"/>
<result column="custom_rights_setting_item_id" property="customRightsSettingItemId"/>
<result column="descripiton" property="descripiton"/>
</resultMap>
<sql id="Base_Column_List" >
id, custom_plan_id, module_type, module_title, button_name, default_url, create_time,
update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
</select>
<select id="getCustomRightsSettingModule" resultMap="VOMap" parameterType="integer">
SELECT
cs.id csid,
custom_plan_id,
module_type,
module_title,
button_name,
default_url,
cr.id crid,
cr.custom_rights_setting_id,
cr.rights_setting_classify_id,
cr.item_title,
cd.id cdid,
cd.custom_rights_setting_item_id ,
cd.descripiton
FROM
`custom_plan_rights_setting` cs
LEFT JOIN custom_rights_setting_item cr ON cs.id = cr.custom_rights_setting_id
left join custom_rights_item_description cd on cr.id = cd.custom_rights_setting_item_id
where cs.custom_plan_id = #{planId}
order by cs.id, cr.id, cd.id;
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from custom_plan_rights_setting
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByPlanId" parameterType="integer">
delete from
custom_plan_rights_setting
where custom_plan_id = #{planId,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.pcloud.book.custom.entity.CustomPlanRightsSetting" useGeneratedKeys="true" keyProperty="id">
insert into custom_plan_rights_setting (custom_plan_id, module_type,
module_title, button_name, default_url,
create_time, update_time)
values (#{customPlanId,jdbcType=BIGINT}, #{moduleType,jdbcType=INTEGER},
#{moduleTitle,jdbcType=VARCHAR}, #{buttonName,jdbcType=VARCHAR}, #{defaultUrl,jdbcType=VARCHAR},
now(),now())
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.custom.entity.CustomPlanRightsSetting" >
insert into custom_plan_rights_setting
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="customPlanId != null" >
custom_plan_id,
</if>
<if test="moduleType != null" >
module_type,
</if>
<if test="moduleTitle != null" >
module_title,
</if>
<if test="buttonName != null" >
button_name,
</if>
<if test="defaultUrl != null" >
default_url,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="customPlanId != null" >
#{customPlanId,jdbcType=BIGINT},
</if>
<if test="moduleType != null" >
#{moduleType,jdbcType=INTEGER},
</if>
<if test="moduleTitle != null" >
#{moduleTitle,jdbcType=VARCHAR},
</if>
<if test="buttonName != null" >
#{buttonName,jdbcType=VARCHAR},
</if>
<if test="defaultUrl != null" >
#{defaultUrl,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.custom.entity.CustomPlanRightsSetting" >
update custom_plan_rights_setting
<set >
<if test="customPlanId != null" >
custom_plan_id = #{customPlanId,jdbcType=BIGINT},
</if>
<if test="moduleType != null" >
module_type = #{moduleType,jdbcType=INTEGER},
</if>
<if test="moduleTitle != null" >
module_title = #{moduleTitle,jdbcType=VARCHAR},
</if>
<if test="buttonName != null" >
button_name = #{buttonName,jdbcType=VARCHAR},
</if>
<if test="defaultUrl != null" >
default_url = #{defaultUrl,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.custom.entity.CustomPlanRightsSetting" >
update custom_plan_rights_setting
set custom_plan_id = #{customPlanId,jdbcType=BIGINT},
module_type = #{moduleType,jdbcType=INTEGER},
module_title = #{moduleTitle,jdbcType=VARCHAR},
button_name = #{buttonName,jdbcType=VARCHAR},
default_url = #{defaultUrl,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
<?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.pcloud.book.custom.mapper.CustomRightsItemDescriptionMapper" >
<resultMap id="BaseResultMap" type="com.pcloud.book.custom.entity.CustomRightsItemDescription" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="custom_rights_setting_item_id" property="customRightsSettingItemId" jdbcType="BIGINT" />
<result column="descripiton" property="descripiton" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, custom_rights_setting_item_id, descripiton, create_time, update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from custom_rights_item_description
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from custom_rights_item_description
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByPlanId">
DELETE custom_rights_item_description
FROM
custom_rights_item_description cd
RIGHT JOIN (
SELECT
crid.id
FROM
custom_rights_item_description crid
left join
custom_rights_setting_item cr on crid.custom_rights_setting_item_id = cr.id
LEFT JOIN custom_plan_rights_setting cp ON cr.custom_rights_setting_id = cp.id
WHERE
cp.custom_plan_id = #{planId}
) m ON cd.id = m.id
</delete>
<insert id="insert" parameterType="com.pcloud.book.custom.entity.CustomRightsItemDescription" >
insert into custom_rights_item_description (id, custom_rights_setting_item_id, descripiton,
create_time, update_time)
values (#{id,jdbcType=BIGINT}, #{customRightsSettingItemId,jdbcType=BIGINT}, #{descripiton,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.custom.entity.CustomRightsItemDescription" >
insert into custom_rights_item_description
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="customRightsSettingItemId != null" >
custom_rights_setting_item_id,
</if>
<if test="descripiton != null" >
descripiton,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="customRightsSettingItemId != null" >
#{customRightsSettingItemId,jdbcType=BIGINT},
</if>
<if test="descripiton != null" >
#{descripiton,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<insert id="batchInsert" parameterType="com.pcloud.book.custom.entity.CustomRightsItemDescription">
insert into custom_rights_item_description (custom_rights_setting_item_id, descripiton,
create_time, update_time)
values
<foreach collection="list" index="index" item="item" separator=",">
(#{item.customRightsSettingItemId,jdbcType=BIGINT}, #{item.descripiton,jdbcType=VARCHAR},
now(), now())
</foreach>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.custom.entity.CustomRightsItemDescription" >
update custom_rights_item_description
<set >
<if test="customRightsSettingItemId != null" >
custom_rights_setting_item_id = #{customRightsSettingItemId,jdbcType=BIGINT},
</if>
<if test="descripiton != null" >
descripiton = #{descripiton,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.custom.entity.CustomRightsItemDescription" >
update custom_rights_item_description
set custom_rights_setting_item_id = #{customRightsSettingItemId,jdbcType=BIGINT},
descripiton = #{descripiton,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
<?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.pcloud.book.custom.mapper.CustomRightsSettingItemMapper" >
<resultMap id="BaseResultMap" type="com.pcloud.book.custom.entity.CustomRightsSettingItem" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="custom_rights_setting_id" property="customRightsSettingId" jdbcType="BIGINT" />
<result column="rights_setting_classify_id" property="rightsSettingClassifyId" jdbcType="BIGINT" />
<result column="item_title" property="itemTitle" jdbcType="VARCHAR" />
<result column="description" property="description" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, custom_rights_setting_id, rights_setting_classify_id, item_title, description,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from custom_rights_setting_item
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from custom_rights_setting_item
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByPlanId" parameterType="integer">
DELETE custom_rights_setting_item
FROM
custom_rights_setting_item cs
RIGHT JOIN (
SELECT
cr.id
FROM
custom_rights_setting_item cr
LEFT JOIN custom_plan_rights_setting cp ON cr.custom_rights_setting_id = cp.id
WHERE
cp.custom_plan_id = #{planId}
) m ON cs.id = m.id
</delete>
<insert id="insert" parameterType="com.pcloud.book.custom.entity.CustomRightsSettingItem" useGeneratedKeys="true" keyProperty="id" >
insert into custom_rights_setting_item (custom_rights_setting_id, rights_setting_classify_id,
item_title, create_time,
update_time)
values (#{customRightsSettingId,jdbcType=BIGINT}, #{rightsSettingClassifyId,jdbcType=BIGINT},
#{itemTitle,jdbcType=VARCHAR}, now(), now())
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.custom.entity.CustomRightsSettingItem" >
insert into custom_rights_setting_item
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="customRightsSettingId != null" >
custom_rights_setting_id,
</if>
<if test="rightsSettingClassifyId != null" >
rights_setting_classify_id,
</if>
<if test="itemTitle != null" >
item_title,
</if>
<if test="description != null" >
description,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="customRightsSettingId != null" >
#{customRightsSettingId,jdbcType=BIGINT},
</if>
<if test="rightsSettingClassifyId != null" >
#{rightsSettingClassifyId,jdbcType=BIGINT},
</if>
<if test="itemTitle != null" >
#{itemTitle,jdbcType=VARCHAR},
</if>
<if test="description != null" >
#{description,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.custom.entity.CustomRightsSettingItem" >
update custom_rights_setting_item
<set >
<if test="customRightsSettingId != null" >
custom_rights_setting_id = #{customRightsSettingId,jdbcType=BIGINT},
</if>
<if test="rightsSettingClassifyId != null" >
rights_setting_classify_id = #{rightsSettingClassifyId,jdbcType=BIGINT},
</if>
<if test="itemTitle != null" >
item_title = #{itemTitle,jdbcType=VARCHAR},
</if>
<if test="description != null" >
description = #{description,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.custom.entity.CustomRightsSettingItem" >
update custom_rights_setting_item
set custom_rights_setting_id = #{customRightsSettingId,jdbcType=BIGINT},
rights_setting_classify_id = #{rightsSettingClassifyId,jdbcType=BIGINT},
item_title = #{itemTitle,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
</insert> </insert>
<select id="getAllRightsClassify" parameterType="map" resultType="com.pcloud.book.rightsSetting.entity.RightsSettingClassify"> <select id="getAllRightsClassify" parameterType="map" resultType="com.pcloud.book.rightsSetting.entity.RightsSettingClassify">
SELECT id, classify, rights_type rightsType SELECT id, classify, rights_type rightsType,pic_url picUrl
FROM rights_setting_classify FROM rights_setting_classify
WHERE 1=1 WHERE 1=1
<if test="rightsType!=null"> <if test="rightsType!=null">
...@@ -140,4 +140,17 @@ ...@@ -140,4 +140,17 @@
rights_setting_id = #{rightsSettingId}; rights_setting_id = #{rightsSettingId};
</select> </select>
<select id="getRightsClassifyMap" parameterType="list" resultType="com.pcloud.book.rightsSetting.entity.RightsSettingClassify">
SELECT id, classify, rights_type rightsType, pic_url picUrl
FROM rights_setting_classify
<where>
<if test="list != null">
id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment