This commit is contained in:
Vinjor 2025-03-18 11:28:17 +08:00
parent cb04ad0741
commit 7ae2ba0ce1
4 changed files with 20 additions and 7 deletions

View File

@ -4,8 +4,11 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -44,12 +47,17 @@ public class BaseCategoryController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('base:category:list')")
@GetMapping("/list")
public AjaxResult list(BaseCategory baseCategory,
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize)
public AjaxResult list(BaseCategory baseCategory)
{
Page<BaseCategory> page = new Page<>(pageNum, pageSize);
IPage<BaseCategory> list = baseCategoryService.queryListPage(baseCategory,page);
LambdaQueryWrapper<BaseCategory> queryWrapper = new LambdaQueryWrapper<BaseCategory>();
if(StringUtils.isNotEmpty(baseCategory.getCode())){
queryWrapper.like(BaseCategory::getCode,baseCategory.getCode());
}
if(StringUtils.isNotEmpty(baseCategory.getTitle())){
queryWrapper.like(BaseCategory::getTitle,baseCategory.getTitle());
}
queryWrapper.orderByAsc(BaseCategory::getSort);
List<BaseCategory> list = baseCategoryService.list(queryWrapper);
return success(list);
}

View File

@ -31,6 +31,9 @@ public class BaseConfig extends DlBaseEntity
/** 唯一编码 */
@Excel(name = "唯一编码")
private String code;
/** 标题 */
@Excel(name = "标题")
private String title;
/** json字符串 */
@Excel(name = "json字符串")

View File

@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="BaseConfig" id="BaseConfigResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="title" column="title" />
<result property="jsonStr" column="json_str" />
<result property="creator" column="creator" />
<result property="createTime" column="create_time" />
@ -16,13 +17,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBaseConfigVo">
select id, code, json_str, creator, create_time, updater, update_time, del_flag from dl_base_config
select id, code,title, json_str, creator, create_time, updater, update_time, del_flag from dl_base_config
</sql>
<select id="queryListPage" parameterType="BaseConfig" resultMap="BaseConfigResult">
<include refid="selectBaseConfigVo"/>
<where>
<if test="entity.code != null and entity.code != ''"> and code = #{entity.code}</if>
<if test="entity.title != null and entity.title != ''"> and title = #{entity.title}</if>
<if test="entity.jsonStr != null and entity.jsonStr != ''"> and json_str = #{entity.jsonStr}</if>
</where>
</select>

View File

@ -61,7 +61,7 @@ public class DefaultDBFieldHandler implements MetaObjectHandler {
// setFieldValByName("updater", userId.toString(), metaObject);
// }
//更新数据时强制更新数据的更新时间和更新人
setFieldValByName("updateTime", LocalDateTime.now(), metaObject);
setFieldValByName("updateTime", new Date(), metaObject);
Long userId = SecurityUtils.getUserId();
if (Objects.nonNull(userId)) {
setFieldValByName("updater", userId.toString(), metaObject);