优化操作
This commit is contained in:
parent
0684f00957
commit
fe4c813b0f
|
@ -23,7 +23,7 @@ public interface ${ClassName}Mapper
|
|||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return ${functionName}
|
||||
*/
|
||||
public ${ClassName}VO select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
${ClassName}VO select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
|
@ -31,7 +31,7 @@ public interface ${ClassName}Mapper
|
|||
* @param query ${functionName}
|
||||
* @return ${functionName}集合
|
||||
*/
|
||||
public List<${ClassName}VO> select${ClassName}List(@Param("query")${ClassName}Query query);
|
||||
List<${ClassName}VO> select${ClassName}List(@Param("query")${ClassName}Query query);
|
||||
|
||||
/**
|
||||
* 新增${functionName}
|
||||
|
@ -39,7 +39,17 @@ public interface ${ClassName}Mapper
|
|||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
public int insert${ClassName}(${ClassName} ${className});
|
||||
int insert${ClassName}(${ClassName} ${className});
|
||||
|
||||
/**
|
||||
* 批量新增${functionName}
|
||||
*/
|
||||
int batchInsert(@Param("list") List<? extends ${ClassName}> list);
|
||||
|
||||
/**
|
||||
* 批量修改${functionName}
|
||||
*/
|
||||
int batchUpdate(@Param("list") List<? extends ${ClassName}> list);
|
||||
|
||||
/**
|
||||
* 修改${functionName}
|
||||
|
@ -55,7 +65,7 @@ public interface ${ClassName}Mapper
|
|||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
|
||||
/**
|
||||
* 批量删除${functionName}
|
||||
|
@ -72,7 +82,7 @@ public interface ${ClassName}Mapper
|
|||
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||
int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||
|
||||
/**
|
||||
* 批量新增${subTable.functionName}
|
||||
|
@ -80,7 +90,7 @@ public interface ${ClassName}Mapper
|
|||
* @param ${subclassName}List ${subTable.functionName}列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batch${subClassName}(List<${subClassName}> ${subclassName}List);
|
||||
int batch${subClassName}(List<${subClassName}> ${subclassName}List);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -89,6 +99,6 @@ public interface ${ClassName}Mapper
|
|||
* @param ${pkColumn.javaField} ${functionName}ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
#end
|
||||
}
|
||||
|
|
|
@ -99,6 +99,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsert" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
|
||||
insert into ${tableName}
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
#foreach($column in $columns)
|
||||
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
|
||||
$column.columnName,
|
||||
#end
|
||||
#end
|
||||
</trim>
|
||||
values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
#foreach($column in $columns)
|
||||
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
|
||||
<if test="i.$column.javaField != null #if($column.javaType == 'String' && $column.required) and i.$column.javaField != ''#end">#{i.$column.javaField},</if>
|
||||
<if test="i.$column.javaField == null #if($column.javaType == 'String' && $column.required) or i.$column.javaField == ''#end">default,</if>
|
||||
#end
|
||||
#end
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate">
|
||||
update ${tableName}
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
#foreach($column in $columns)
|
||||
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
|
||||
<foreach open="$column.columnName = CASE $pkColumn.columnName" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.$column.javaField != null #if($column.javaType == 'String' && $column.required) and item.$column.javaField != ''#end">
|
||||
WHEN #{item.$pkColumn.columnName} THEN #{item.$column.javaField}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.$pkColumn.columnName} THEN `$column.columnName`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
#end
|
||||
#end
|
||||
</trim>
|
||||
where $pkColumn.columnName in
|
||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||
#{item.$pkColumn.javaField}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="update${ClassName}" parameterType="${ClassName}">
|
||||
update ${tableName}
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ruoyi.system.user.domain;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -30,6 +29,9 @@ public class SysUserQuery extends SysUserVO {
|
|||
@ApiModelProperty("精准微信openId")
|
||||
private String eqWxOpenId;
|
||||
|
||||
@ApiModelProperty("关键词")
|
||||
private String keyword;
|
||||
|
||||
@ApiModelProperty("精准工号")
|
||||
private String eqUserNo;
|
||||
|
||||
|
|
|
@ -80,6 +80,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="userName != null and userName != ''">
|
||||
AND u.user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (
|
||||
u.nick_name like concat('%', #{keyword}, '%')
|
||||
or u.user_no like concat('%', #{keyword}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND u.status = #{status}
|
||||
</if>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.ruoyi.yh.price.domain.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2025/1/13
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PriceColumn {
|
||||
category,
|
||||
size,
|
||||
surface,
|
||||
pattern
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.ruoyi.yh.price.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2025/1/13
|
||||
*/
|
||||
@Data
|
||||
public class PriceColumnCountVO {
|
||||
|
||||
@ApiModelProperty("标签")
|
||||
private String label;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
private Integer count;
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.ruoyi.yh.price.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2025/1/13
|
||||
*/
|
||||
@Data
|
||||
public class PriceSearchConditionVO {
|
||||
|
||||
@ApiModelProperty("类别")
|
||||
private List<PriceColumnCountVO> categoryList;
|
||||
|
||||
@ApiModelProperty("大小")
|
||||
private List<PriceColumnCountVO> sizeList;
|
||||
|
||||
@ApiModelProperty("表面处理")
|
||||
private List<PriceColumnCountVO> surfaceList;
|
||||
|
||||
@ApiModelProperty("图案")
|
||||
private List<PriceColumnCountVO> patternList;
|
||||
|
||||
|
||||
}
|
|
@ -1,11 +1,13 @@
|
|||
package com.ruoyi.yh.price.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.yh.price.domain.Price;
|
||||
import com.ruoyi.yh.price.domain.PriceVO;
|
||||
import com.ruoyi.yh.price.domain.PriceQuery;
|
||||
import com.ruoyi.yh.price.domain.PriceVO;
|
||||
import com.ruoyi.yh.price.domain.vo.PriceColumnCountVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 单价Mapper接口
|
||||
*
|
||||
|
@ -66,4 +68,9 @@ public interface PriceMapper
|
|||
* 条件更新
|
||||
*/
|
||||
int updateByQuery(@Param("data") Price data, @Param("query") PriceQuery query);
|
||||
|
||||
/**
|
||||
* 查询列统计
|
||||
*/
|
||||
List<PriceColumnCountVO> selectColumnCount(@Param("query") PriceQuery query, @Param("column") String column);
|
||||
}
|
||||
|
|
|
@ -101,6 +101,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where bp.price_id = #{priceId}
|
||||
</select>
|
||||
|
||||
<resultMap id="PriceColumnCountVO" type="PriceColumnCountVO">
|
||||
<result property="count" column="count" typeHandler="com.ruoyi.common.mybatis.typehandler.NonNullIntegerTyperHandler"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectColumnCount" resultMap="PriceColumnCountVO">
|
||||
select
|
||||
bp.${column} as label,
|
||||
count(bp.price_id) as `count`
|
||||
from bst_price bp
|
||||
left join sys_dept sd on sd.dept_id = bp.dept_id
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
group by label
|
||||
order by `count` desc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrice" parameterType="Price" useGeneratedKeys="true" keyProperty="priceId">
|
||||
insert into bst_price
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.ruoyi.yh.price.domain.PriceQuery;
|
|||
import com.ruoyi.yh.price.domain.PriceVO;
|
||||
import com.ruoyi.yh.price.domain.dto.PriceImportParams;
|
||||
import com.ruoyi.yh.price.domain.dto.PriceVerifyDTO;
|
||||
import com.ruoyi.yh.price.domain.vo.PriceSearchConditionVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -121,4 +122,9 @@ public interface PriceService
|
|||
* 逻辑删除
|
||||
*/
|
||||
int logicDel(Long id);
|
||||
|
||||
/**
|
||||
* 查询条件
|
||||
*/
|
||||
PriceSearchConditionVO selectSearchCondition(PriceQuery query);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,9 @@ import com.ruoyi.yh.price.domain.PriceQuery;
|
|||
import com.ruoyi.yh.price.domain.PriceVO;
|
||||
import com.ruoyi.yh.price.domain.dto.PriceImportParams;
|
||||
import com.ruoyi.yh.price.domain.dto.PriceVerifyDTO;
|
||||
import com.ruoyi.yh.price.domain.enums.PriceColumn;
|
||||
import com.ruoyi.yh.price.domain.enums.PriceStatus;
|
||||
import com.ruoyi.yh.price.domain.vo.PriceSearchConditionVO;
|
||||
import com.ruoyi.yh.price.mapper.PriceMapper;
|
||||
import com.ruoyi.yh.price.service.PriceService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -430,4 +432,16 @@ public class PriceServiceImpl implements PriceService
|
|||
query.setDeleted(false);
|
||||
return this.updateByQuery(data, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PriceSearchConditionVO selectSearchCondition(PriceQuery query) {
|
||||
PriceSearchConditionVO vo = new PriceSearchConditionVO();
|
||||
|
||||
vo.setCategoryList(priceMapper.selectColumnCount(query, PriceColumn.category.name()));
|
||||
vo.setSizeList(priceMapper.selectColumnCount(query, PriceColumn.size.name()));
|
||||
vo.setSurfaceList(priceMapper.selectColumnCount(query, PriceColumn.surface.name()));
|
||||
vo.setPatternList(priceMapper.selectColumnCount(query, PriceColumn.pattern.name()));
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,17 @@ public class PriceController extends BaseController
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取查询条件数据
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('yh:price:list')")
|
||||
@GetMapping("/searchCondition")
|
||||
@DataScope(deptAlias = "sd")
|
||||
public AjaxResult searchCondition(PriceQuery query)
|
||||
{
|
||||
return success(priceService.selectSearchCondition(query));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('yh:price:list')")
|
||||
@PostMapping("/listByIds")
|
||||
public AjaxResult listByIds(@RequestBody List<Long> priceIds)
|
||||
|
|
Loading…
Reference in New Issue
Block a user