manailin
2021-09-13 81d6fcf1ce21bec50e4b1382074479cff53f6957
[新增]将user 模块下dao层的sql 全部转化到xml 中执行。
3个文件已修改
41 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/RoleDAO.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/SysUserFeedbackDAO.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/mapper/RoleDAO.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/RoleDAO.java
@@ -3,7 +3,6 @@
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -18,18 +17,18 @@
 **/
@Mapper
public interface RoleDAO extends BaseMapper<SysRoleDO> {
    @Select("select r.* from sys_user_role u join sys_role r on u.role_id=r.role_id where u.user_id=#{userId}")
    List<SysRoleDO> selectByUserId(Long userId);
    @Select("select r.role_key role,m.component url from sys_role r join sys_role_menu rm on r.role_id=rm.role_id join sys_menu m on rm.menu_id=m.menu_id WHERE m.component is not null ")
    List<MenuVO> selectAllMenuUrl();
    @Select("select r.role_key from sys_user_role ur join sys_role r on ur.role_id = r.role_id where ur.user_id=#{username}")
    List<String> selectRoles(String username);
    @Select("")
    Long selectMaxRole(Long communityId);
    @Select("delete from sys_role where role_key =#{roleKey}")
    void deleteByRoleKey(@RequestParam("roleKey") String roleKey);
}
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/SysUserFeedbackDAO.java
@@ -2,7 +2,6 @@
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -19,32 +18,9 @@
 **/
@Mapper
public interface SysUserFeedbackDAO extends BaseMapper<SysUserFeedbackDO> {
    // @Select("<script> " +
    // " <where>" +
    // "<if test='nameCn != null and nameCn.trim() != &quot;&quot;'>" +
    // " </if> " +
    // "<if test='nameCn != null and nameCn.trim() != &quot;&quot;'>" +
    // " </if> " +
    // "<if test='nameCn != null and nameCn.trim() != &quot;&quot;'>" +
    // " </if> " +
    // " </where>" +
    // "</script>")
    @Select("<script> " + "select \n" + "u.name,\n" + "u.nick_name,\n" + "f.id,\n" + "u.phone,\n" + "f.create_at,\n"
        + "f.content,\n" + "f.photo_path,\n" + "c.name communityName\n" + "from sys_user_feedback f\n"
        + "left join sys_user u on f.user_id=u.user_id\n" + "left join com_act c on u.community_id=c.community_id\n"
        + "<where>" + "<if test='pageFeedBackDTO.phone != null and pageFeedBackDTO.phone.trim() != &quot;&quot;'>"
        + "and u.phone like concat('%',#{pageFeedBackDTO.phone},'%') \n" + " </if> "
        + "<if test='pageFeedBackDTO.name != null and pageFeedBackDTO.name.trim() != &quot;&quot;'>"
        + "and u.name like concat('%',#{pageFeedBackDTO.name},'%')   \n" + " </if> "
        + "<if test='pageFeedBackDTO.nickName != null and pageFeedBackDTO.nickName.trim() != &quot;&quot;'>"
        + "and u.nick_name like concat('%',#{pageFeedBackDTO.nickName},'%') \n" + " </if> " + "</where> "
        + "order by f.create_at desc\n" + "</script>")
    IPage<SysUserFeedbackVO> pageFeedback(Page page, @Param("pageFeedBackDTO") PageFeedBackDTO pageFeedBackDTO);
    @Select("select \n" + "u.name,\n" + "u.nick_name,\n" + "f.id,\n" + "f.content,\n" + "f.photo_path,\n" + "u.phone,\n"
        + "f.create_at,\n" + "c.name communityName\n" + "from sys_user_feedback f\n"
        + "join sys_user u on f.user_id=u.user_id\n" + "join com_act c on u.community_id=c.community_id\n"
        + "where f.id=#{id}\n")
    SysUserFeedbackVO detailFeedback(Long id);
}
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/mapper/RoleDAO.xml
@@ -39,9 +39,9 @@
    </select>
    <select id="deleteByRoleKey">
    <delete id="deleteByRoleKey">
         delete from sys_role where role_key =#{roleKey}
    </select>
    </delete>
</mapper>